Sunday, August 21, 2011

SORTING COMPLEXITIES

 

SORTING

BEST CASE

AVERAGE CASE

WORST CASE

Insertion Sort

O(n)

O(n2)

O(n2)

Bubble Sort

O(n)

O(n2)

O(n2)

Selection Sort

O(n2)

O(n2)

O(n2)

Quick Sort

O(n log n)

O(n log n)

O(n2)

Merge Sort

O(n log n) typically , O(n)

O(n log n)

O(n log n)

Heap Sort

O(n log n)

O(n log n)

O(n log n)

Radix Sort

O(kn)

O(kn)

O(kn)

Counting Sort

O(n+k)

O(n+k)

O(n+k)

No comments:

Post a Comment