October 2025
Intermediate to advanced
485 pages
13h 2m
English
We now arrive at a pivotal question. Which sorting algorithm is better, Mergesort or Quicksort? Quicksort was the fastest sorting algorithm we covered in Volume 1, but let’s look at how Mergesort measures up to it. (To follow this discussion, you don’t need to remember all the nitty-gritty details of Quicksort; I’ll remind you of the pertinent facts.)
As discussed in Volume 1, Quicksort has an average speed of O(N log N). Now, given that Mergesort also runs, on average, in O(N log N) time, it would seem at first glance that the two algorithms are equally fast. In reality, though, Quicksort is faster than Mergesort in what I call actual time.
I use the term actual time to refer to time as measured ...
Read now
Unlock full access