This repo contains the easy sorting algorithm code.
-
Bubble Sort
- Time:
- Best: O(n)
- Worst: O(n^2)
- Space:
- Constant: no auxiliary space used
- O(1)
- Stable Sorting Algorithm
- In-place sorting Algorithm
- Time:
-
Selection Sort
- Time: - Best: O(n^2) - Worst: O(n^2)
- Space:
- Constant: no auxiliary space used
- O(1)
- Not Stable Sorting Algorithm
- In-place sorting Algorithm
-
Insertion Sort
- Time:
- Best: O(n)
- Worst: O(n^2)
- Space:
- Constant: no auxiliary space used
- O(1)
- Stable Sorting Algorithm
- In-place sorting Algorithm
- Time:
-
Counting Sort
- Time:
- Best: O(n)
- Worst: O(n)
- Space:
- Constant: no auxiliary space used
- O(1)
- Stable Sorting Algorithm
- In-place sorting Algorithm
- Time:
-
Quick Sort
- Time: (depends on the choosing of pivot element)
- Best: O(nlogn)
- Worst: O(n^2)
- Space:
- Recursion stack
- O(n)
- Not Stable Sorting Algorithm
- Time: (depends on the choosing of pivot element)
-
Merge Sort
- Time:
- Best: O(nlogn)
- Worst: O(nlogn)
- Space:
- O(n)
- Stable Sorting Algorithm
- Time: