August 2020
Intermediate to advanced
508 pages
11h 53m
English
Indeed, in a worst-case scenario, Selection Sort is faster than Insertion Sort. However, it is critical we also take into account the average-case scenario.
Why?
By definition, the cases that occur most frequently are average scenarios. Take a look at this simple bell curve:

Best- and worst-case scenarios happen relatively infrequently. In the real world, average scenarios are what occur most of the time.
Take a randomly sorted array, for example. What are the odds that the values will occur in perfect ascending or descending order? It’s much more likely that the values will be all over the place.
Let’s examine Insertion Sort, ...
Read now
Unlock full access