0%
Algorithm Time Complexity
Algorithm |
Best Time Complexity |
Ave TC |
Worst TC |
Selection Sort |
Ω($n^2$) |
Θ($n^2$) |
O($n^2$) |
Bubble Sort |
Ω($n$) |
Θ($n^2$) |
O($n^2$) |
Insertion Sort |
Ω($n$) |
Θ($n^2$) |
O($n^2$) |
Heap Sort |
Ω($nlogn$) |
Θ($nlogn$) |
O($nlogn$) |
Quick Sort |
Ω($nlogn$) |
Θ($nlogn$) |
O($n^2$) |
Merge Sort |
Ω($nlogn$) |
Θ($nlogn$) |
O($nlogn$) |
Bucket Sort |
Ω($n+k$) |
Θ($n+k$) |
O($n^2$) |
Radix Sort |
Ω($nk$) |
Θ($nk$) |
O($nk$) |
Time Complexity Rank
- O($logn$) ——————– e.g. Binary Tree
- O($n$) ——————– e.g. Simple Search
- O($nlogn$) ——————– e.g. Quick Sort
- O($n^2$) ——————– e.g. Selection Sort (Not Recommended Time Complexity)
Java IDEA IDE ShortCut
- sout + enter
- psvm + enter
- fori + enter
- iter + enter