Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

Radix Sort

Used to sort integer numbers
sort by:
first sorting the first rightmost digit of every number
then move to the next number to the left and then sort it (if no such digit exists, then it is 0).
after we're totally done, the numbers will be sorted in order.

for example
10, 5, 4, 3, 2
in this case:
if we want to sort these in ascending order
the first sort will result in
10, 2, 3, 4, 5
10 will be the "smallest" number
however, the next sort with the next digit will put things in proper order
In that case we are sorting
1-0, 0-2, 0-3, 0-4, 0-5
1 is (obviously) the largest of the digits. 
So it is in the rightest.
The correct order is now 2,3,4,5,10
Source by www.cs.yale.edu #
 
PREVIOUS NEXT
Tagged: #Radix #Sort
ADD COMMENT
Topic
Name
8+4 =