You are on page 1of 1

Worst case

Average case
Best case
BubbleSort
O(n^2)
O(n^2)?
O(n)
SelectionSort
O(n^2)
O(n^2)
O(n^2)
(it can depend on sort order and data arrangement)
InsertionSort
O(n^2)
O(n^2)
O(n)
BitonicSort

O(n log^2 n)

ShellSort
QuickSort
HeapSort
SmoothSort

O(n^2)
O(n^2)
O(n log n)
O(n log n)

O(n
O(n
O(n
O(n

n)?
n)
n)
n)?

MergeSort
TimSort

O(n log n)
O(n log n)

O(n log n)
O(n log n)?

CountingSort
RadixSort
BucketSort

O(n+k)
O(n+k)
O(n^2)

O(n log^2 n)?


log
log
log
log

O(n+k)
O(n+k)
O(n+k)

Extra space
O(1)
O(1)

Stable?
yes
No

O(1)

yes

O(1)?

O(n)
O(n log n)
O(n log n)
O(n)

O(1)
O(log n)
O(1)
O(1)

no
no
no
no

O(n log n)
O(n)

O(n)
O(n)

yes
yes

O(n+k)
O(n+k)
?????

O(n+k)
yes
O(n+k)
yes
O(n*k) or O(n+k) ?

Sequential Searching Can search from unordered list Time complexity O(n)
Binary searching Can search from ordered list only Time complexity O(log 2n)
Tenary searching Can search from ordered list only Time complexity O(log 3n)

Data Structure Traverse


Search
Unsorted L List N N
Sorted L List N N
Unsorted Array N N
Sorted Array N Log N
Binary Tree N N
BST N N
F&B BST
N Log N

You might also like