Professional Documents
Culture Documents
Time and Space Complexities of Some Well Known Algorithms
Time and Space Complexities of Some Well Known Algorithms
Time and Space Complexities of Some Well Known Algorithms
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|)
O(N+n)
O(N*n)
O(n2)
O(n)
12) BogoSort
O()
O(nlog(3)/log(1.5))
14) IntroSort
O(nlogn)
O(n)
O(n2)
O(1)
O(n2)
O(1)
O(nlogn)
O(1)
18) TimSort
O(nlogn)
O(1)
O(n2)
O(1)
O(n2)
O(n)
O(nlogn)
O(n)
O(n2)
O(n)
O(n2)
O(1)
O(n)
O(n)