1.What does O(n log n) mean, and which common algorithms have it?
Show hint
Think about how many times the input can be halved, and how much work happens per level.
Show solution
The work grows like n × log n: slightly faster than linear. It typically comes from splitting the input in halves (log n levels) and doing O(n) work per level. Merge sort, heap sort, quick sort on average, and Python's sorted() are O(n log n). It is also the best possible worst case for any sort that only compares items.