SlideShare a Scribd company logo
2
Most read
6
Most read
7
Most read
Quick Sort in Data Structures
Prof. Neeraj Bhargava
Kapil Chauhan
Department of Computer Science
School of Engineering & Systems Sciences
MDS University, Ajmer
Introduction
 Quick sort is a fast sorting algorithm used to sort a list
of elements.
 The quick sort algorithm attempts to separate the list
of elements into two parts and then sort each part
recursively.
Cont..
 That means it use divide and conquer strategy.
 In quick sort, the partition of the list is performed
based on the element called pivot.
Cont…
 Here pivot element is one of the elements in the list.
 The list is divided into two partitions such that "all
elements to the left of pivot are smaller than the
pivot and all elements to the right of pivot are
greater than or equal to the pivot".
Cont..
 It is also called partition-exchange sort. This
algorithm divides the list into three main parts:
 Elements less than the Pivot element
 Pivot element(Central element)
 Elements greater than the pivot element
Example
Algorithm
 Step 1 − Choose the highest index value has pivot
 Step 2 − Take two variables to point left and right of the list
excluding pivot
 Step 3 − left points to the low index
 Step 4 − right points to the high
 Step 5 − while value at left is less than pivot move right
Step 6 − while value at right is greater than pivot move left
 Step 7 − if both step 5 and step 6 does not match swap left
and right
 Step 8 − if left ≥ right, the point where they met is new
pivot
Assignment
 Explain Quick Sort in data structure with suitable
example and discuss basic operation.

More Related Content

What's hot (20)

PPTX
Binary Tree Traversal
Dhrumil Panchal
 
PPTX
Tree in data structure
ghhgj jhgh
 
PPTX
Binary Tree in Data Structure
Meghaj Mallick
 
PPTX
trees in data structure
shameen khan
 
PPTX
Tree Traversal
Md. Israil Fakir
 
PPTX
Doubly Linked List
V.V.Vanniaperumal College for Women
 
PPTX
Tree
Raj Sarode
 
PPTX
Stack and queue
CHANDAN KUMAR
 
PPTX
Stacks IN DATA STRUCTURES
Sowmya Jyothi
 
PPTX
linked list in Data Structure, Simple and Easy Tutorial
Afzal Badshah
 
PPTX
Binary Search Tree
Abhishek L.R
 
PPT
Data Structure and Algorithms Linked List
ManishPrajapati78
 
PPT
Binary search tree(bst)
Hossain Md Shakhawat
 
PPT
Red black tree
Rajendran
 
PPTX
Different Sorting tecniques in Data Structure
Tushar Gonawala
 
PPTX
AVL Tree Data Structure
Afaq Mansoor Khan
 
PPTX
Breadth First Search & Depth First Search
Kevin Jadiya
 
PPTX
Priority Queue in Data Structure
Meghaj Mallick
 
PPTX
THREADED BINARY TREE AND BINARY SEARCH TREE
Siddhi Shrivas
 
Binary Tree Traversal
Dhrumil Panchal
 
Tree in data structure
ghhgj jhgh
 
Binary Tree in Data Structure
Meghaj Mallick
 
trees in data structure
shameen khan
 
Tree Traversal
Md. Israil Fakir
 
Stack and queue
CHANDAN KUMAR
 
Stacks IN DATA STRUCTURES
Sowmya Jyothi
 
linked list in Data Structure, Simple and Easy Tutorial
Afzal Badshah
 
Binary Search Tree
Abhishek L.R
 
Data Structure and Algorithms Linked List
ManishPrajapati78
 
Binary search tree(bst)
Hossain Md Shakhawat
 
Red black tree
Rajendran
 
Different Sorting tecniques in Data Structure
Tushar Gonawala
 
AVL Tree Data Structure
Afaq Mansoor Khan
 
Breadth First Search & Depth First Search
Kevin Jadiya
 
Priority Queue in Data Structure
Meghaj Mallick
 
THREADED BINARY TREE AND BINARY SEARCH TREE
Siddhi Shrivas
 

Similar to Quick sort data structures (20)

DOCX
Quick sort
Fabia Nayeem
 
PDF
A Comparative Study of Sorting and Searching Algorithms
IRJET Journal
 
PPTX
Searching,sorting
LavanyaJ28
 
PPTX
Data Structures_ Sorting & Searching
ThenmozhiK5
 
PPTX
DS - Unit 2 FINAL (2).pptx
prakashvs7
 
DOCX
Quick sort
maamir farooq
 
PPTX
Sorting
FahadSaeed39
 
PPTX
Sorting Algorithms.pptx
MuhammadAli2977
 
PPTX
Searching_Sorting.pptx
21BD1A058RSahithi
 
PPTX
Searching_Techniques Binary search Algorithm
Anil Yadav
 
PPTX
Sorting Algorithms to arrange data in particular format
itsusamazahid
 
PPTX
What is a Sorting Algorithm Ishank mini project.pptx
SneakyGoblin1
 
PDF
How to Implement Sorting Algorithms in C++ and Difficulty Faced in Coding it?...
PhD Assistance
 
PDF
Ijcse13 05-01-048
vital vital
 
PDF
Ijcse13 05-01-048
vital vital
 
PDF
Data Structure & Algorithms - Operations
babuk110
 
PPTX
How to Implement Sorting Algorithms in C++ and Difficulty Faced in Coding it?...
PhD Assistance
 
PPTX
DS PPT - ( 1 )SORTING lgoritham techniques with bast example
Vivek487417
 
PPT
Data Structures 2
Dr.Umadevi V
 
PPTX
MYSQL DATABASE MYSQL DATABASEquick-sort.pptx
ArjayBalberan1
 
Quick sort
Fabia Nayeem
 
A Comparative Study of Sorting and Searching Algorithms
IRJET Journal
 
Searching,sorting
LavanyaJ28
 
Data Structures_ Sorting & Searching
ThenmozhiK5
 
DS - Unit 2 FINAL (2).pptx
prakashvs7
 
Quick sort
maamir farooq
 
Sorting
FahadSaeed39
 
Sorting Algorithms.pptx
MuhammadAli2977
 
Searching_Sorting.pptx
21BD1A058RSahithi
 
Searching_Techniques Binary search Algorithm
Anil Yadav
 
Sorting Algorithms to arrange data in particular format
itsusamazahid
 
What is a Sorting Algorithm Ishank mini project.pptx
SneakyGoblin1
 
How to Implement Sorting Algorithms in C++ and Difficulty Faced in Coding it?...
PhD Assistance
 
Ijcse13 05-01-048
vital vital
 
Ijcse13 05-01-048
vital vital
 
Data Structure & Algorithms - Operations
babuk110
 
How to Implement Sorting Algorithms in C++ and Difficulty Faced in Coding it?...
PhD Assistance
 
DS PPT - ( 1 )SORTING lgoritham techniques with bast example
Vivek487417
 
Data Structures 2
Dr.Umadevi V
 
MYSQL DATABASE MYSQL DATABASEquick-sort.pptx
ArjayBalberan1
 
Ad

More from chauhankapil (20)

PPTX
Gray level transformation
chauhankapil
 
PPTX
Elements of visual perception
chauhankapil
 
PPTX
JSP Client Request
chauhankapil
 
PPTX
Jsp server response
chauhankapil
 
PPTX
Markov decision process
chauhankapil
 
PPTX
RNN basics in deep learning
chauhankapil
 
PPTX
Introduction to generative adversarial networks (GANs)
chauhankapil
 
PPTX
Bayesian probabilistic interference
chauhankapil
 
PPTX
Jsp
chauhankapil
 
PPTX
Exception handling in java
chauhankapil
 
PPTX
Knowledge acquistion
chauhankapil
 
PPTX
Knowledge based system
chauhankapil
 
PPTX
Introduction of predicate logics
chauhankapil
 
PPTX
Types of inheritance in java
chauhankapil
 
PPTX
Representation of syntax, semantics and Predicate logics
chauhankapil
 
PPTX
Inheritance in java
chauhankapil
 
PPTX
Propositional logic
chauhankapil
 
PPTX
Constructors in java
chauhankapil
 
PPTX
Methods in java
chauhankapil
 
PPT
Circular linked list
chauhankapil
 
Gray level transformation
chauhankapil
 
Elements of visual perception
chauhankapil
 
JSP Client Request
chauhankapil
 
Jsp server response
chauhankapil
 
Markov decision process
chauhankapil
 
RNN basics in deep learning
chauhankapil
 
Introduction to generative adversarial networks (GANs)
chauhankapil
 
Bayesian probabilistic interference
chauhankapil
 
Exception handling in java
chauhankapil
 
Knowledge acquistion
chauhankapil
 
Knowledge based system
chauhankapil
 
Introduction of predicate logics
chauhankapil
 
Types of inheritance in java
chauhankapil
 
Representation of syntax, semantics and Predicate logics
chauhankapil
 
Inheritance in java
chauhankapil
 
Propositional logic
chauhankapil
 
Constructors in java
chauhankapil
 
Methods in java
chauhankapil
 
Circular linked list
chauhankapil
 
Ad

Recently uploaded (20)

PDF
A Brief Introduction About Robert Paul Hardee
Robert Paul Hardee
 
PDF
LLC CM NCP1399 SIMPLIS MODEL MANUAL.PDF
ssuser1be9ce
 
PPT
FINAL plumbing code for board exam passer
MattKristopherDiaz
 
PDF
13th International Conference on Artificial Intelligence, Soft Computing (AIS...
ijait
 
PDF
Python Mini Project: Command-Line Quiz Game for School/College Students
MPREETHI7
 
PPTX
template.pptxr4t5y67yrttttttttttttttttttttttttttttttttttt
SithamparanaathanPir
 
PPTX
Engineering Quiz ShowEngineering Quiz Show
CalvinLabial
 
PPTX
Introduction to File Transfer Protocol with commands in FTP
BeulahS2
 
PDF
輪読会資料_Miipher and Miipher2 .
NABLAS株式会社
 
PPTX
Engineering Quiz ShowEngineering Quiz Show
CalvinLabial
 
PPTX
Stability of IBR Dominated Grids - IEEE PEDG 2025 - short.pptx
ssuser307730
 
PDF
CLIP_Internals_and_Architecture.pdf sdvsdv sdv
JoseLuisCahuanaRamos3
 
PPTX
FSE_LLM4SE1_A Tool for In-depth Analysis of Code Execution Reasoning of Large...
cl144
 
PDF
June 2025 - Top 10 Read Articles in Network Security and Its Applications
IJNSA Journal
 
PPSX
OOPS Concepts in Python and Exception Handling
Dr. A. B. Shinde
 
PDF
Clustering Algorithms - Kmeans,Min ALgorithm
Sharmila Chidaravalli
 
PPTX
UNIT 1 - INTRODUCTION TO AI and AI tools and basic concept
gokuld13012005
 
PDF
Module - 5 Machine Learning-22ISE62.pdf
Dr. Shivashankar
 
PDF
PROGRAMMING REQUESTS/RESPONSES WITH GREATFREE IN THE CLOUD ENVIRONMENT
samueljackson3773
 
PDF
How to Buy Verified CashApp Accounts IN 2025
Buy Verified CashApp Accounts
 
A Brief Introduction About Robert Paul Hardee
Robert Paul Hardee
 
LLC CM NCP1399 SIMPLIS MODEL MANUAL.PDF
ssuser1be9ce
 
FINAL plumbing code for board exam passer
MattKristopherDiaz
 
13th International Conference on Artificial Intelligence, Soft Computing (AIS...
ijait
 
Python Mini Project: Command-Line Quiz Game for School/College Students
MPREETHI7
 
template.pptxr4t5y67yrttttttttttttttttttttttttttttttttttt
SithamparanaathanPir
 
Engineering Quiz ShowEngineering Quiz Show
CalvinLabial
 
Introduction to File Transfer Protocol with commands in FTP
BeulahS2
 
輪読会資料_Miipher and Miipher2 .
NABLAS株式会社
 
Engineering Quiz ShowEngineering Quiz Show
CalvinLabial
 
Stability of IBR Dominated Grids - IEEE PEDG 2025 - short.pptx
ssuser307730
 
CLIP_Internals_and_Architecture.pdf sdvsdv sdv
JoseLuisCahuanaRamos3
 
FSE_LLM4SE1_A Tool for In-depth Analysis of Code Execution Reasoning of Large...
cl144
 
June 2025 - Top 10 Read Articles in Network Security and Its Applications
IJNSA Journal
 
OOPS Concepts in Python and Exception Handling
Dr. A. B. Shinde
 
Clustering Algorithms - Kmeans,Min ALgorithm
Sharmila Chidaravalli
 
UNIT 1 - INTRODUCTION TO AI and AI tools and basic concept
gokuld13012005
 
Module - 5 Machine Learning-22ISE62.pdf
Dr. Shivashankar
 
PROGRAMMING REQUESTS/RESPONSES WITH GREATFREE IN THE CLOUD ENVIRONMENT
samueljackson3773
 
How to Buy Verified CashApp Accounts IN 2025
Buy Verified CashApp Accounts
 

Quick sort data structures

  • 1. Quick Sort in Data Structures Prof. Neeraj Bhargava Kapil Chauhan Department of Computer Science School of Engineering & Systems Sciences MDS University, Ajmer
  • 2. Introduction  Quick sort is a fast sorting algorithm used to sort a list of elements.  The quick sort algorithm attempts to separate the list of elements into two parts and then sort each part recursively.
  • 3. Cont..  That means it use divide and conquer strategy.  In quick sort, the partition of the list is performed based on the element called pivot.
  • 4. Cont…  Here pivot element is one of the elements in the list.  The list is divided into two partitions such that "all elements to the left of pivot are smaller than the pivot and all elements to the right of pivot are greater than or equal to the pivot".
  • 5. Cont..  It is also called partition-exchange sort. This algorithm divides the list into three main parts:  Elements less than the Pivot element  Pivot element(Central element)  Elements greater than the pivot element
  • 7. Algorithm  Step 1 − Choose the highest index value has pivot  Step 2 − Take two variables to point left and right of the list excluding pivot  Step 3 − left points to the low index  Step 4 − right points to the high  Step 5 − while value at left is less than pivot move right Step 6 − while value at right is greater than pivot move left  Step 7 − if both step 5 and step 6 does not match swap left and right  Step 8 − if left ≥ right, the point where they met is new pivot
  • 8. Assignment  Explain Quick Sort in data structure with suitable example and discuss basic operation.