This post features popular sorting algorithms.
List of Sorting Algorithms
Sorting algorithms featured on this post:
- Insertion sort
- Bubble sort
- Cocktail shaker sort
- Selection sort
- Merge sort
- Quicksort
- Heapsort
Insertion Sort
Its complexity is O(n²).
Bubble Sort
Its complexity is O(n²).
Cocktail Shaker Sort
Cocktail shaker sort is a variation to bubble sort.
Its complexity is O(n²).
Cocktail Shaker Sort at Wikipedia
Selection Sort
Its complexity is O(n²).
Merge Sort
Merge sort is based on a divide-and-conquer approach.
Its complexity is O(n log(n)).
Quicksort
Quicksort is unstable. This is said because elements are swapped according to pivot’s position (without considering their original positions).
Its complexity is O(n log(n)).
Heapsort
Its time complexity is O(n log(n)).
You might also be interested in…
External References
- Merge Sort
- Wikipedia community; “Merge sort”; Wikipedia