TALLA PADMAVATHI COLLEGE OF ENGINEERING
AUTONOMOUS
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
3rd year 1 semester
Presented By
Thakur Rishitha singh
23UC1A0528
Presentation on
Design And Analysis Of Algorithms
Quick Sort
Faculty Head of the department
Ms. N. Sandhya Ms. J. Shilpa
1
Index
Introduction
Algorithm
Example
2
Introduction
QuickSort is a sorting algorithm based on the Divide and Conquer that picks an
element as a pivot and partitions the given array around the picked pivot by placing
the pivot in its correct position in the sorted array.
It works on the principle of divide and conquer, breaking down the problem into
smaller sub-problems.
Algorithm
Algorithm QUICKSORT(A, low, high) {
if low < high {
p = PARTITION(A, low, high)
QUICKSORT(A, low, p-1)
QUICKSORT(A, p+1, high)
Algorithm PARTITION(A, low, high) {
// pivot = A[high] pivot =
A[high] i = low - 1 for j =
low to high-1 if A[j] <=
pivot i = i + 1 swap A[i],
A[j] swap A[i+1], A[high]
return i+1
}}}
4
Example
6
5
7
8
6
9
n
b
i
n
b
HOD Signature:- Subject Faculty Signature:-
10
b
k
11