The next algorithm the course required us to implement is QuickSort. QuickSort is quite a well known algorithm and, theoretically speaking, it performs as good as Merge Sort ( O(n log n) time ). In practice however, it usually comes out faster. Choosing the pivot well is essential to a good running time.
Here is my implementation, with the pivot choosing subroutine left out:
In my next post I will show how we can choose a good pivot and how much it matters.
Geen opmerkingen:
Een reactie posten