Wednesday, April 15, 2020

Time complexities




Linear search.     O(n)
Binary search.     O(logn)
Bubble sort           O(n^2)
Selection sort        O(n^2)
Insertion sort        O(n^2)
Merge sort              O(nlog n)
Quick sort               O(n^2)
Heap sort                 O(nlog n)
Bucket sort              O(n^2)
Radix sort                O(nk)
Tim sort                  O(nlog n)
She'll sort.               O((nlog n))*2)

No comments:

Post a Comment