Time Complexity Flashcards
1
Q
Sort algos what is there best case and worst case with time complexity
bubble
selection
insertion
quick
merge
heap
A
bubble
best O(N) sorted
worst O(n^2) reverse sorted
selection
best O(N^2) anything
worst O(n^2) reverse sorted
insertion
best O(n) sorted
worst O(n^2) anything/reverse sorted
quick
O(n log n) 50:50
worst
O(n^2) pivot at 1 or n-1
merge
heap
both O(n log n) anything best and worst
2
Q
A