Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 42s1 days 16 hours 1 minutes 42 seconds.
Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 42s1 days 16 hours 1 minutes 42 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.