SlideShare a Scribd company logo
1 of 66
Download to read offline
ALGORITHM
ALGORITHM
SORT
Selection Sort Quick Sort
ALGORITHM
SORT INTRO
What is Sort?
ALGORITHM
SORT INTRO
Make data in Sequence
4 3 8 6 7 13 10 14 9
3 4 6 7 8 9 10 13 14
ALGORITHM
SORT INTRO
Make data in Sequence
Key
(comparing data)
Sort Order
(Ascending, Descending)
Sort
Efficiency
(time complexity)
Sort
Stability
(keep sort order)
ALGORITHM
SORT Selection Sort
Selection Sort
ALGORITHM
SORT Selection Sort
select best-fit-data every time
s s d d .. d d d d
sorted unsorted
select data fits this position
ALGORITHM
SORT Selection Sort
4 3 8 6 7 13 10 14 9
Selection Sort in Ascend order
Min Data
unsorted
ALGORITHM
SORT Selection Sort
3 4 8 6 7 13 10 14 9
Selection Sort in Ascend order
unsorted
swap
sorted
ALGORITHM
SORT Selection Sort
3 4 8 6 7 13 10 14 9
Selection Sort in Ascend order
unsortedsorted
Min Data
ALGORITHM
SORT Selection Sort
3 4 8 6 7 13 10 14 9
Selection Sort in Ascend order
unsortedsorted
ALGORITHM
SORT Selection Sort
3 4 8 6 7 13 10 14 9
Selection Sort in Ascend order
unsortedsorted
Min Data
ALGORITHM
SORT Selection Sort
3 4 6 8 7 13 10 14 9
Selection Sort in Ascend order
unsortedsorted
swap
ALGORITHM
SORT Selection Sort
3 4 6 8 7 13 10 14 9
Selection Sort in Ascend order
unsortedsorted
Min Data
ALGORITHM
SORT Selection Sort
3 4 6 7 8 13 10 14 9
Selection Sort in Ascend order
unsortedsorted
swap
ALGORITHM
SORT Selection Sort
3 4 6 7 8 13 10 14 9
Selection Sort in Ascend order
unsortedsorted
Min Data
ALGORITHM
SORT Selection Sort
3 4 6 7 8 13 10 14 9
Selection Sort in Ascend order
unsortedsorted
ALGORITHM
SORT Selection Sort
3 4 6 7 8 13 10 14 9
Selection Sort in Ascend order
unsortedsorted
Min Data
ALGORITHM
SORT Selection Sort
3 4 6 7 8 9 10 14 13
Selection Sort in Ascend order
unsortedsorted
swap
ALGORITHM
SORT Selection Sort
3 4 6 7 8 9 10 14 13
Selection Sort in Ascend order
unsortedsorted
Min Data
ALGORITHM
SORT Selection Sort
3 4 6 7 8 9 10 14 13
Selection Sort in Ascend order
unsortedsorted
ALGORITHM
SORT Selection Sort
3 4 6 7 8 9 10 14 13
Selection Sort in Ascend order
unsortedsorted
Min Data
ALGORITHM
SORT Selection Sort
3 4 6 7 8 9 10 13 14
Selection Sort in Ascend order
unsortedsorted
swap
ALGORITHM
SORT Selection Sort
3 4 6 7 8 9 10 13 14
Selection Sort in Ascend order
sorted
ALGORITHM
SORT Quick Sort
Quick Sort
divide dataset with pivot
s … p ... d d d d d
less than p bigger than p
pivot
ALGORITHM
SORT Quick Sort
select pivot
ALGORITHM
SORT Quick Sort
4 3 8 6 7 13 2 14 9
pivot
left right
Move left to first data bigger than pivot
ALGORITHM
SORT Quick Sort
4 3 8 6 7 13 2 14 9
pivot
left right
Move right to first data less than pivot
ALGORITHM
SORT Quick Sort
4 3 8 6 7 13 2 14 9
pivot
left right
swap left and right
ALGORITHM
SORT Quick Sort
4 3 2 6 7 13 8 14 9
pivot
left right
Move left to first data bigger than pivot
ALGORITHM
SORT Quick Sort
4 3 2 6 7 13 8 14 9
pivot
left right
Move right to first data less than pivot
ALGORITHM
SORT Quick Sort
4 3 2 6 7 13 8 14 9
pivot
left
right
swap right with pivot
ALGORITHM
SORT Quick Sort
2 3 4 6 7 13 8 14 9
pivot
swap right with pivot
ALGORITHM
SORT Quick Sort
2 3 4 6 7 13 8 14 9
pivot
less than 4 bigger than 4
sorting problem divided into two problems
ALGORITHM
SORT Quick Sort
2 3 4 6 7 13 8 14 9
less than 4 bigger than 4
sort left partition
ALGORITHM
SORT Quick Sort
2 3
pivot
left
right
Move left to first data bigger than pivot
ALGORITHM
SORT Quick Sort
2 3
pivot
left
right
Move right to first data less than pivot
ALGORITHM
SORT Quick Sort
2 3
pivot
left
right
sorted
ALGORITHM
SORT Quick Sort
2 3
try right part
ALGORITHM
SORT Quick Sort
2 3 4 6 7 13 8 14 9
sorted bigger than 4
sort right partition
ALGORITHM
SORT Quick Sort
6 7 13 8 14 9
pivot
left
right
ALGORITHM
SORT Quick Sort
6 7 13 8 14 9
pivot
left
right
Move left to first data bigger than pivot
ALGORITHM
SORT Quick Sort
6 7 13 8 14 9
pivot
left
right
Move right to first data less than pivot
ALGORITHM
SORT Quick Sort
sorting problem divided into two problems but left is none
6 7 13 8 14 9…
bigger than 6
ALGORITHM
SORT Quick Sort
sort right partition
7 13 8 14 9
pivot
left
right
ALGORITHM
SORT Quick Sort
7 13 8 14 9
pivot
left
right
Move left to first data bigger than pivot
ALGORITHM
SORT Quick Sort
7 13 8 14 9
pivot
left
right
Move right to first data less than pivot
ALGORITHM
SORT Quick Sort
7 13 8 14 9…
bigger than 7
sorting problem divided into two problems but left is none
ALGORITHM
SORT Quick Sort
13 8 14 9
sort right partition
pivot
left
right
ALGORITHM
SORT Quick Sort
13 8 14 9
pivot
left
right
Move left to first data bigger than pivot
ALGORITHM
SORT Quick Sort
13 8 14 9
pivot
left
Move right to first data less than pivot
right
ALGORITHM
SORT Quick Sort
13 8 9 14
pivot
left
right
swap left and right
ALGORITHM
SORT Quick Sort
9 8 13 14
pivot
swap pivot and right
right
ALGORITHM
SORT Quick Sort
9 8 13 14
less than 13 bigger than 13
sorting problem divided into two problems
ALGORITHM
SORT Quick Sort
9 8 13 14
less than 13 sorted
no need to sort one element
ALGORITHM
SORT Quick Sort
9 8
sort left partition
pivot
left
right
ALGORITHM
SORT Quick Sort
9 8
pivot
left
right
Move left to first data bigger than pivot
ALGORITHM
SORT Quick Sort
9 8
pivot
left
right
Move right to first data less than pivot
ALGORITHM
SORT Quick Sort
8
Swap left and right
9
pivot
ALGORITHM
SORT Quick Sort
8
sorted
9
ALGORITHM
SORT Quick Sort
8
sorted
9
ALGORITHM
SORT Quick Sort
8 9 13 14
less than 13 sorted
sorted
ALGORITHM
SORT Quick Sort
sorted
7 8 9 13 14
bigger than 7
ALGORITHM
SORT Quick Sort
sorted
6 7 8 9 13 14
bigger than 6
sorted
ALGORITHM
SORT Quick Sort
2 3 4 6 7 8 9 13 14
sorted bigger than 4
sort complete
ALGORITHM
SORT Quick Sort
2 3 4 6 7 8 9 13 14
sorted

More Related Content

Recently uploaded

GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jNeo4j
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsJean Silva
 
Understanding Plagiarism: Causes, Consequences and Prevention.pptx
Understanding Plagiarism: Causes, Consequences and Prevention.pptxUnderstanding Plagiarism: Causes, Consequences and Prevention.pptx
Understanding Plagiarism: Causes, Consequences and Prevention.pptxSasikiranMarri
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingShane Coughlan
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecturerahul_net
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolsosttopstonverter
 
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdfSteve Caron
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...Bert Jan Schrijver
 
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfPros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfkalichargn70th171
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogueitservices996
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptxVinzoCenzo
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesVictoriaMetrics
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...OnePlan Solutions
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITmanoharjgpsolutions
 
Mastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxMastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxAS Design & AST.
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonApplitools
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?Alexandre Beguel
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdfAndrey Devyatkin
 

Recently uploaded (20)

GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero results
 
Understanding Plagiarism: Causes, Consequences and Prevention.pptx
Understanding Plagiarism: Causes, Consequences and Prevention.pptxUnderstanding Plagiarism: Causes, Consequences and Prevention.pptx
Understanding Plagiarism: Causes, Consequences and Prevention.pptx
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecture
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration tools
 
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
 
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfPros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogue
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptx
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 Updates
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh IT
 
Mastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxMastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptx
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
 

Intersection Study - Algorithm(Sort)