October 2025
Intermediate to advanced
485 pages
13h 2m
English
When I benchmark Mergesort using the code in Benchmarking Sorting Algorithms for an array of 10 elements, I get these results:
| | [2.6941299438476562e-05, 2.2172927856445312e-05, 2.193450927734375e-05, |
| | 2.193450927734375e-05, 2.193450927734375e-05] |
As I’ve said, these numbers aren’t very meaningful until we contrast them with the benchmarking results of a competing algorithm. So, let’s go ahead and benchmark Insertion Sort and compare the two sets of results.
Before we do so, it’s always good to hypothesize as to what the results might be. This way, if we get totally different results, we can more easily notice if something fishy is going on and decide if our experiment isn’t engineered correctly.
You learned in ...
Read now
Unlock full access