0% found this document useful (0 votes)
26 views15 pages

Quick Sort

The document shows the step-by-step process of quicksort sorting an array of numbers. It starts with an unsorted array of numbers and uses a pivot element to partition the array into two halves, with all elements less than the pivot on one side and greater elements on the other side. It then recursively applies the same process on the two sub-arrays until the entire array is sorted.

Uploaded by

stuti mehta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views15 pages

Quick Sort

The document shows the step-by-step process of quicksort sorting an array of numbers. It starts with an unsorted array of numbers and uses a pivot element to partition the array into two halves, with all elements less than the pivot on one side and greater elements on the other side. It then recursively applies the same process on the two sub-arrays until the entire array is sorted.

Uploaded by

stuti mehta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 15

Quick Sort

Data

30 70 80 50 20 10 90 55 40

Pivot i j

arr[i]<=Pivot Arr[j]>=Pivot
i=i+1 j=j+1
Data

30 70 80 50 20 10 90 55 40

Pivot i j

arr[i]<=Pivot Arr[j]>=Pivot
i=i+1 j=j+1
Data

30 70 80 50 20 10 90 55 40

Pivot i j

arr[i]<=Pivot Arr[j]>=Pivot
i=i+1 j=j+1
Data

30 70 80 50 20 10 90 55 40

Pivot i j

arr[i]<=Pivot Arr[j]>=Pivot
i=i+1 j=j+1
Data

30 70 80 50 20 10 90 55 40

Pivot i j

arr[i]<=Pivot Arr[j]>=Pivot
i=i+1 j=j+1
Data
30 70 80 50 20 10 90 55 40

Pivot i j

30 10 80 50 20 70 90 55 40

Pivot i j
Data
30 10 80 50 20 70 90 55 40

Pivot i j

arr[i]<=Pivot Arr[j]>=Pivot
i=i+1 j=j+1
Data
30 10 80 50 20 70 90 55 40

Pivot i j

arr[i]<=Pivot Arr[j]>=Pivot
i=i+1 j=j+1
Data
30 10 80 50 20 70 90 55 40

Pivot i j

arr[i]<=Pivot Arr[j]>=Pivot
i=i+1 j=j+1
Data
30 10 80 50 20 70 90 55 40

Pivot i j

30 10 20 50 80 70 90 55 40

Pivot i j
Data
30 10 20 50 80 70 90 55 40

Pivot i j

arr[i]<=Pivot Arr[j]>=Pivot
i=i+1 j=j+1
Data
30 10 20 50 80 70 90 55 40

Pivot i j

arr[i]<=Pivot Arr[j]>=Pivot
i=i+1 j=j+1
Data
30 10 20 50 80 70 90 55 40

Pivot j i

20 10 30 50 80 70 90 55 40

Pivot j i
Data
20 10 30 50 80 70 90 55 40

Pivot j i

20 10 30 50 80 70 90 55 40
Pivot ij Pivot i j

You might also like