Big O Cheat sheet¶
- | Time Complexity | Space Complexity | ||
---|---|---|---|---|
Best - Ω | Average - θ | Worst - O | Worst - O | |
Quick Sort | n log(n) | n log(n) | n2 | log(n) |
Bubble Sort | n | n2 | n2 | 1 |
Merge Sort | n log(n) | n log(n) | n log(n) | n |
Insertion Sort | n | n2 | n2 | 1 |
Selection Sort | n2 | n2 | n2 | 1 |
Heap Sort | n log(n) | n log(n) | n log(n) | 1 |
Bucket Sort | n + k | n + k | n2 | n |
Radix Sort | nk | nk | nk | n + k |