SlideShare a Scribd company logo
1 of 14
Algorithms Task-4
By/ Saad Mohamed Saad
Merge Sort Pseudocode
Quick Sort Problem
5 3 1 9 8 2 4 7
left right
pivot
Sorting list of Numbers
[5, 3, 1, 9, 8, 2, 4, 7]
5 3 1 9 8 2 4 7
left right
pivot
Comparing left with right and sort
small numbers at the left
Here, the left and right
are already sorted
5 3 1 9 8 2 4 7
left right
pivot
Algorithm moves forward one
position towards left
5 3 1 9 8 2 4 7
left right
pivot
Doing the same thing to compare left with
right and sort small numbers at the left
Here, the left and
right are not sorted
4 3 1 9 8 2 5 7
right
left
pivot
So, we swap value in the left
with its in the right
And the pivot stays
points at the same value
4 3 1 9 8 2 5 7
right
left
pivot
And then left will move to
the next index
4 3 1 9 8 2 5 7
right
left
pivot
Then, we repeat the same steps with each
element to get left, right and pivot at the
same index. Hence, the element is sorted
4 3 1 2 5 8 9 7
right
left
pivot
Here, (5) is sorted. And we surely know that
elements on its left is smaller than its right
1 2 3 4 5 7 8 9
right
left
pivot
We do the same thing recursively to the two
left and right sub array of the pivot element
until we get the list sorted as seen;
Thank You
Any Question.?

More Related Content

Similar to Algorithms Task-4.pdf

sorting and searching.pptx
sorting and searching.pptxsorting and searching.pptx
sorting and searching.pptxParagAhir1
 
Insertion Sort, Quick Sort And Their complexity
Insertion Sort, Quick Sort And Their complexityInsertion Sort, Quick Sort And Their complexity
Insertion Sort, Quick Sort And Their complexityMotaleb Hossen Manik
 
Absolute Value and the Fundamental Operations on Integers.pptx
Absolute Value and the Fundamental Operations on Integers.pptxAbsolute Value and the Fundamental Operations on Integers.pptx
Absolute Value and the Fundamental Operations on Integers.pptxHazelCola1
 
Algorithm and Data Structure - Binary Search
Algorithm and Data Structure - Binary SearchAlgorithm and Data Structure - Binary Search
Algorithm and Data Structure - Binary SearchAndiNurkholis1
 
Introduction to Positive and Negative Numbers
Introduction to Positive and Negative NumbersIntroduction to Positive and Negative Numbers
Introduction to Positive and Negative NumbersMelanie_Anderson
 
Add and subtract pos and neg numbers 4 parts
Add and subtract pos and neg numbers 4 partsAdd and subtract pos and neg numbers 4 parts
Add and subtract pos and neg numbers 4 partsMelanie_Anderson
 
Chapter 1 Study Guide
Chapter 1  Study  GuideChapter 1  Study  Guide
Chapter 1 Study Guide♥Moriah♥
 
Chapter 1 Study Guide
Chapter 1  Study  GuideChapter 1  Study  Guide
Chapter 1 Study Guide♥Moriah♥
 

Similar to Algorithms Task-4.pdf (10)

sorting and searching.pptx
sorting and searching.pptxsorting and searching.pptx
sorting and searching.pptx
 
Insertion Sort, Quick Sort And Their complexity
Insertion Sort, Quick Sort And Their complexityInsertion Sort, Quick Sort And Their complexity
Insertion Sort, Quick Sort And Their complexity
 
Absolute Value and the Fundamental Operations on Integers.pptx
Absolute Value and the Fundamental Operations on Integers.pptxAbsolute Value and the Fundamental Operations on Integers.pptx
Absolute Value and the Fundamental Operations on Integers.pptx
 
Algorithm and Data Structure - Binary Search
Algorithm and Data Structure - Binary SearchAlgorithm and Data Structure - Binary Search
Algorithm and Data Structure - Binary Search
 
Introduction to Positive and Negative Numbers
Introduction to Positive and Negative NumbersIntroduction to Positive and Negative Numbers
Introduction to Positive and Negative Numbers
 
Add and subtract pos and neg numbers 4 parts
Add and subtract pos and neg numbers 4 partsAdd and subtract pos and neg numbers 4 parts
Add and subtract pos and neg numbers 4 parts
 
Chapter 1 Study Guide
Chapter 1  Study  GuideChapter 1  Study  Guide
Chapter 1 Study Guide
 
Chapter 1 Study Guide
Chapter 1  Study  GuideChapter 1  Study  Guide
Chapter 1 Study Guide
 
Unit 2 - Quick Sort.pptx
Unit 2 - Quick Sort.pptxUnit 2 - Quick Sort.pptx
Unit 2 - Quick Sort.pptx
 
Integers
IntegersIntegers
Integers
 

More from SaadMohamedSaad2

More from SaadMohamedSaad2 (7)

Modeling&Simulation-Template.pdf
Modeling&Simulation-Template.pdfModeling&Simulation-Template.pdf
Modeling&Simulation-Template.pdf
 
IS-Security Projects.pdf
IS-Security Projects.pdfIS-Security Projects.pdf
IS-Security Projects.pdf
 
IS-Security-Template.pdf
IS-Security-Template.pdfIS-Security-Template.pdf
IS-Security-Template.pdf
 
Software Engineering .pptx
Software  Engineering .pptxSoftware  Engineering .pptx
Software Engineering .pptx
 
S.W Project Template2.pdf
S.W Project Template2.pdfS.W Project Template2.pdf
S.W Project Template2.pdf
 
SOFTWARE ENGINEERING.docx
SOFTWARE ENGINEERING.docxSOFTWARE ENGINEERING.docx
SOFTWARE ENGINEERING.docx
 
3-12.pdf
3-12.pdf3-12.pdf
3-12.pdf
 

Recently uploaded

Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 

Recently uploaded (20)

Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 

Algorithms Task-4.pdf

  • 3.
  • 5. 5 3 1 9 8 2 4 7 left right pivot Sorting list of Numbers [5, 3, 1, 9, 8, 2, 4, 7]
  • 6. 5 3 1 9 8 2 4 7 left right pivot Comparing left with right and sort small numbers at the left Here, the left and right are already sorted
  • 7. 5 3 1 9 8 2 4 7 left right pivot Algorithm moves forward one position towards left
  • 8. 5 3 1 9 8 2 4 7 left right pivot Doing the same thing to compare left with right and sort small numbers at the left Here, the left and right are not sorted
  • 9. 4 3 1 9 8 2 5 7 right left pivot So, we swap value in the left with its in the right And the pivot stays points at the same value
  • 10. 4 3 1 9 8 2 5 7 right left pivot And then left will move to the next index
  • 11. 4 3 1 9 8 2 5 7 right left pivot Then, we repeat the same steps with each element to get left, right and pivot at the same index. Hence, the element is sorted
  • 12. 4 3 1 2 5 8 9 7 right left pivot Here, (5) is sorted. And we surely know that elements on its left is smaller than its right
  • 13. 1 2 3 4 5 7 8 9 right left pivot We do the same thing recursively to the two left and right sub array of the pivot element until we get the list sorted as seen;