Sorting Conclusions
That's it! There are other sorting algorithms (e.g. shell sort, block sort), but we won't be discussing them in this class.
Remember, here's the criteria by which we judged our sorting algorithms:
- Time complexity
- Space complexity
- Adaptivitiy
- Stability
- Simplicity
No one algorithm wins in all the categories, but here are the rough take-away points:
- Merge sort comes the closest to being the all-around best. When in doubt, use it.
- Quick sort can be better, but it's not stable, and you need to take steps to ensure you don't use it for sorted data.
- For semi-sorted data, insertion sort is the most adaptive sort.
Here they all are, one last time: