Quicksort
Implementation of quicksort which offers a choice of 3 different partitioning algorithms, and compares the performance of the 3 by counting the number of comparisons made.
The 3 partitioning algorithms are:
- First element
- Last element
- Median of 3 (median of first, last, and middle element)
Run on a list of 10,000 elements, the 3 partitioning algorithms perform as follows
Partitioning Algorithm | Number of Comparisons |
---|---|
First Element | 162085 |
Last Element | 164123 |
Median of Three | 138382 |