Quick Sort
Quick sort is another divide and conquer sort. Pick a pivot item, split the rest into items smaller than the pivot and items larger, then sort each side by calling itself and join: smaller side, pivot, larger side.
On average it is O(n log n) and very fast in practice. A badly chosen pivot (always the smallest item on an already-sorted list) degrades it to O(n squared). In real code you use Python's built-in sorted() or .sort(), which uses an even better algorithm called Timsort.
What is a pivot in quick sort?
Use the pivot idea once: with pivot 5, print the items smaller than the pivot, then the items larger, each as a list on its own line.
Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.
Tip: use the left and right arrow keys to move between lessons.