You are on page 1of 2

Time and Space Complexities of some well known

Algorithms
Name of the Algorithm

Time Complexity

Space Complexity

1) Selection Sort

O(n2)

O(n)

2) Insertion Sort

O(n2)

O(n)

3) Bubble Sort

O(n2)

O(n)

4) Merge Sort

(nlogn)

(n)

5) Quick Sort

O(n2)

O(n)

6) Heap Sort

(nlogn)

(n)

7) Shell Sort

O(nlog2n)

O(n)

8) Radix Sort

O(kn)

O(kn)

9) Counting Sort

O(|s|+n)

O(|s|)

10) Pegionhole Sort

O(N+n)

O(N*n)

11) Library Sort

O(n2)

O(n)

12) BogoSort

O()

13) Stooge Sort

O(nlog(3)/log(1.5))

14) IntroSort

O(nlogn)

O(n)

15) Combo Sort

O(n2)

O(1)

16) Gnome Sort

O(n2)

O(1)

17) Smooth Sort

O(nlogn)

O(1)

18) TimSort

O(nlogn)

O(1)

19) Cocktail Sort

O(n2)

O(1)

20) Binary Tree Sort

O(n2)

O(n)

21) Patience Sort

O(nlogn)

O(n)

22) Strand Sort

O(n2)

O(n)

23) Comb Sort

O(n2)

O(1)

O(n)
O(n)

You might also like