Skip to content

Latest commit

 

History

History
43 lines (28 loc) · 636 Bytes

File metadata and controls

43 lines (28 loc) · 636 Bytes

Big O of Sorting Algo :-

Compariosion Sorts :-

Bubble Sort :-

Time (Best) O(n) Time (Avg/Worst) O(n^2) Space O(1)

Insertion Sort :- Works best in the senario where you a continuous flow of data and you have to return a sorted result-set Time (Best) O(n) Time (Avg/Worst) O(n^2) Space O(1)

Selection Sort :-

Time (Best) O(n^2) Time (Avg/Worst) O(n^2) Space O(1)

Merge Sort :-

Time (Best) O(n log n) Time (Avg/Worst) O(n log n) Space O(n)

Quick Sort :-

Time (Best) O(n log n) Time (Avg/Worst) O(n log n) Space O(log n)

Non-Compaisions Sorting :-

Redix Sort - Numbers

Time (Best) O(nk) Time (Avg/Worst) O(nk) Space O(n+k)