Pattern Recognition Drill
Medium Sorting
The Problem
Sort an array using quicksort with Lomuto partition.
What approach would you use?
Think about it before scrolling down.
Partition places pivot correctly. Recurse on left and right partitions. O(n log n) average.
Common Trap
Worst case is O(n²) with bad pivot choice (already sorted). Random pivot selection avoids this.