Lesson
Sorting Algorithms
Sorting arranges data in order. Algorithms differ in time complexity and in whether they are stable (preserving the relative order of equal keys). Comparison sorts cannot beat $O(n \\log n)$ in the worst case.
Practice
Even fast algorithms have worst cases. The number of comparisons a simple scan needs is often one fewer than the number of items.
Quiz