Dushyant Jodha Dushyant Jodha

Radix Sort is a Sorting algorithm that is useful when there is a constant'd' such that all keys are d digit numbers. To execute Radix Sort, for p =1 towards 'd' sort the numbers with respect to the Pth digits from the right using any linear time stable sort.

The Code for Radix Sort is straightforward. The following procedure assumes that each element in the n-element array A has d digits, where digit 1 is the lowest order digit and digit d is the highest-order digit.


Here is the algorithm that sorts A [1.n] where each number is d digits long.


RADIX-SORT (array A, int n, int d) 
 1 for i ← 1 to d 
 2 do stably sort A to sort array A on digit i

Example: The first Column is the input. The remaining Column shows the list after successive sorts on increasingly significant digit position. The vertical arrows indicate the digits position sorted on to produce each list from the previous one.



  1. 576     49[4]     9[5]4     [1]76     176  
  2. 494     19[4]     5[7]6     [1]94     194  
  3. 194     95[4]     1[7]6     [2]78     278  
  4. 296   → 57[6]  →  2[7]8   → [2]96   → 296  
  5. 278     29[6]     4[9]4     [4]94     494  
  6. 176     17[6]     1[9]4     [5]76     576  
  7. 954     27[8]     2[9]6     [9]54     954  


Dushyant Jodha

Dushyant Jodha Creator

(No description available)

Suggested Creators

Dushyant Jodha