⚡ Build the skills to land top-paying quant jobs. Offer ends in 17d 22h 19m 19s17 days 22 hours 19 minutes 19 seconds.
⚡ Build the skills to land top-paying quant jobs. Offer ends in 17d 22h 19m 19s17 days 22 hours 19 minutes 19 seconds.

Sign in to watch this lesson
Algorithms - Sorting and Searching · 4:34
We partition [3, 8, 2, 5, 1, 4, 7, 6] around 4 with Hoare's two inward-walking arrows, then break quicksort three ways: sorted input with a first-element pivot, an adversary that defeats median-of-three, and repeated keys, where Lomuto goes quadratic and a three-way partition finishes in one pass. Then we open libc++'s std::sort on this Mac, an introsort with insertion sort for small ranges and a heapsort fallback after 2·log2 n levels, and measure it against the same adversary. Finally, why the comparator must be a strict weak ordering: a <= comparator crashes std::sort here.