A Common-Sense Guide to Data Structures and Algorithms, Second Edition, 2nd Edition
by Jay Wengrow
Sorting as a Key to Other Algorithms
As of this writing, the fastest sorting algorithms we know of have speeds of O(N log N). While Quicksort is one of the most popular among them, there are many others as well. Mergesort is another well-known O(N log N) sorting algorithm, and I recommend you look it up, as it is a beautiful recursive algorithm.
The fact that the fastest sorting algorithms are O(N log N) is quite important, as this has implications for other algorithms as well. This is because there are algorithms that use sorting as a component of a larger process.
For example, if you’ll recall from Chapter 4, Speeding Up Your Code with Big O, we dealt with the problem of checking whether there are duplicate values within an array.
The first ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access