Merge Sort
- This algorithm is interesting as it has a worst and average case of
O(nlogn)
- However, it is not in-place (Requires extra memory)
- It is stable too. (The relative position of two elements of the same value is the same before and after sorting.)
|
|
Quick Sort
- Good all-purpose sorting algorithm
- In-place (Sorting is done without extra memory)
- Not stable
- It has an average case of
O(nlogn)
and a worst case ofO(n)
- The algorithm
|
|
- In order to reduce the possibility of the worst case from happening, we should randomly choose the pivot.
Counting sort
- The algo
|
|
- Time complexity is
O(n+k)
- It is very efficient if the range of elements is small and known
- Counting sort is stable.
Radix Sort
- The algo
|
|
- Time complexity is
O(n*k)
where n is the number of elements and k is the number of radices. - It is very efficient to sort integers with similar number of integers
Bucket Sort
|
|
Time complexity is theta(n)
/O(n+k)
where n is the number of elements and k is the number of buckets.
Shell Sort
- Algorithm
|
|
- gaps usually divides by 2 every iteration
- Does not have a fixed time complexity.
- Apparently, it is good for sorting with limited memory?