Quick Sort
Quick Sort
Example
Consider the list: 42, 23, 74, 11, 65, 58,
94, 36, 99, 87
Take 42 as pivot element.
42 23 74 11 65 58 94 36 99 87
key 74>42 ,
23>42 ,
Yes
No.
Store the
Go to next
location, it is
element
3.
Search for
bigger
element than
key from left
to right. Stop
when found.
Example
Consider the list: 42, 23, 74, 11, 65, 58,
94, 36, 99, 87
42 23 74 11 65 58 94 36 99 87
42 23 36 11 65 58 94 74 99 87
key
11 23 36 42 65 58 94 74 99 87
Larger than
key Smaller than
pivot pivot
Any observation here?
11 23 36 42 65 58 94 74 99 87