Exercise 3: Ranking Complexity Classes — Possible Solution ==================================================================== THE RANKING, SLOWEST-GROWING TO FASTEST-GROWING ------------------------------ Per this chapter's own ranked ladder of complexity classes: O(1) < O(log n) < O(n) < O(n log n) < O(n^2) < O(2^n) JUSTIFYING O(n log n)'S PLACEMENT BETWEEN O(n) AND O(n^2) ------------------------------ O(n log n) grows faster than plain O(n) because it's literally O(n) multiplied by an additional, slowly-growing log n factor - for any n greater than 1, log n is greater than 1, so n log n is always at least as large as n, and strictly larger for any n > 2. This is why O(n log n) sits directly above O(n) in the ranking, not below or equal to it. At the same time, O(n log n) grows slower than O(n^2), because n^2 can be thought of as n multiplied by an additional factor of n itself, and n grows much faster than log n does as n increases (per this chapter's own growth-rate table, log n barely moves from n=5 to n=20 while n grows by a full factor of 4). Since the "extra factor" in n log n (which is log n) grows so much more slowly than the "extra factor" in n^2 (which is n itself), n log n falls comfortably between plain O(n) and O(n^2) in the overall ranking. WHY THIS WORKS AS AN ANSWER ------------------------------ The ranking is stated directly from this chapter's own established ladder of complexity classes, and O(n log n)'s specific placement is justified by comparing its own "extra factor" (log n) against both neighboring classes' own extra factors (1 for O(n), n for O(n^2)) rather than simply asserting the ordering without explanation.