0% found this document useful (0 votes)
73 views9 pages

Radix, Bucket and Shell Sort

Radix sort is a sorting algorithm that is useful for sorting keys that have a small range of values, such as short integers. It is integral to suffix array construction algorithms and useful on parallel machines. However, it is less flexible than other sorts as it depends on the type of data, takes more space than in-place sorts like quicksort, and has a greater constant than other algorithms.

Uploaded by

King Shah 673
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views9 pages

Radix, Bucket and Shell Sort

Radix sort is a sorting algorithm that is useful for sorting keys that have a small range of values, such as short integers. It is integral to suffix array construction algorithms and useful on parallel machines. However, it is less flexible than other sorts as it depends on the type of data, takes more space than in-place sorts like quicksort, and has a greater constant than other algorithms.

Uploaded by

King Shah 673
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

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:

You might also like