Java: Sort an array of given integers using Radix sort Algorithm
Write a Java program to sort an array of given integers using the Radix sort algorithm.
According to Wikipedia "In computer science, radix sort is a non-comparative integer sorting algorithm that sorts data with integer keys by grouping keys by the individual digits that share the same significant position and value".
Sample Solution:
Java Code:
Sample Output:
Original Array: [7, -5, 3, 2, 1, 0, 45] Sorted Array: [-5, 0, 1, 2, 3, 7, 45]
Flowchart:

For more Practice: Solve these Related Problems:
- Write a Java program to implement radix sort for an array of integers including negative numbers.
- Write a Java program to extend radix sort to sort a list of strings by their characters.
- Write a Java program to implement a stable version of radix sort and compare its performance with merge sort.
- Write a Java program to modify radix sort to sort floating-point numbers by first scaling them appropriately.
Java Code Editor:
Contribute your code and comments through Disqus.
Previous: Write a Java program to sort an array of given integers using the Bubble sorting Algorithm.
Next: Write a Java program to sort an array of given integers using Merge sort Algorithm.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics