Though we have tried to cover many commonly used sorting algorithms, this is not the end of all sorting algorithms. There are many other algorithms that are not covered in this book and are open for you to explore.
Out of all the algorithms discussed here, the following table gives a nice comparison of their performance:
Algorithm |
Performance |
Bubble sort | O(n2) |
Selection sort | O(n2) |
Insertion sort | O(n2) |
Merge sort | O(n log n) |
Quick sort | O(n log n) in worst O(n2) |
Heap sort | O(n log n) |
Now, you might have a better understanding of which sorting algorithm to choose, and when.