§ — — Data Structures and Algorithms
Quick sort is a divide-and-conquer sorting algorithm. It chooses a value called a pivot, partitions the list around that pivot, and then recursively sorts the smaller partitions.
After partitioning:
A quick sort implementation may choose:
The partition step is the key part of quick sort. Given a pivot, the algorithm rearranges the array so the pivot is placed where it belongs in the sorted order.
Example:
Original: {10, 3, 30, 25, 48, 4, 36}
Sorted: {3, 4, 10, 25, 30, 36, 48}
Quick sort reaches the sorted result by repeatedly partitioning smaller sections of the list.
ProReviewer — locked
Drills, code labs, and full solutions.
Done with this module? Track it — your progress shows on the subject list.
You've finished this subject