There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult. C.A.R. Hoare

Radix sort

Language Java | Level Intermediate | Category Algorithms | August 2, 2015 9:11 pm


Algorithm Problem Description

Radix sort is a linear sorting algorithm that sorts data by grouping keys. The individual digits which share the same significant position and value.

Radix sort helps to sort fixed length words. Radix sort requires fixed size key and difficult to generalize. It can use with integers, fixed size strings, and "less than", "greater than" or "lexicographic order" comparison predicates.

Two classifications of radix sorts are least significant digit (LSD) radix sorts and most significant digit (MSD) radix sorts. LSD radix sorts process the integer representations starting from the least digit and moves towards the most significant digit. MSD radix sorts work the other way around. LSD radix sort typically uses for sorting the keys in ascending order with same key length. MSD radix sort typically uses for sorting strings with fixed length.

Radix sorts are often, in practice, the fastest and most useful sorts on parallel machines. Write a program to implement radix sort.

Output

          	        
          	        

Unsorted array before sorting: [12, 34, 56, 23, 45, 78, 46]
Sorted array After Radix Sort sorting: [12, 23, 34, 45, 46, 56, 78]

          	        
          	        				    


Comments



Please login to add comments.