Radix Sort
• Advantages :
i. Fast when the keys are short i.e. when the range of the array elements
is less.
ii. Used in suffix array construction algorithms like Manber's algorithm and
DC3 algorithm.
Disadvantages:
i. Since Radix Sort depends on digits or letters, Radix Sort is much less
flexible than other sorts. Hence , for every different type of data it needs
to be rewritten.
ii. The constant for Radix sort is greater compared to other sorting
algorithms.
iii. It takes more space compared to Quicksort which is inplace sorting.
The Radix Sort algorithm is an important sorting algorithm that is integral to
suffix -array construction algorithms. It is also useful on parallel machines.
Radix Sort Example
Bucket Sort
Bucket Sort
Shell Sort -General Description
Essentially a segmented insertion sort
Divides an array into several smaller non-contiguous
segments
The distance between successive elements in one
segment is called a gap.
Each segment is sorted within itself using insertion sort.
Then re-segment into larger segments (smaller gaps)
and repeat sort.
Continue until only one segment (gap = 1) - final sort
finishes array sorting.
Shell Sort -Example (gap = 4)
[0] [1] [2] [3] [4] [5] [6] [7] [8]
theArray 80 93 60 12 42 30 68 85 10
n: 9 i:
gap: 4 j:
Shell Sort -Example (gap = 2)
[0] [1] [2] [3] [4] [5] [6] [7] [8]
theArray 10 30 60 12 42 93 68 85 80
n: 9 i:
gap: 2 j:
Shell Sort - Example (gap = 1)
[0] [1] [2] [3] [4] [5] [6] [7] [8]
theArray 10 12 42 30 60 85 68 93 80
n: 9 i:
gap: 1 j: