| 49 | // The main function to that sorts arr[] of |
| 50 | // size n using Radix Sort |
| 51 | static void radixsort(int arr[], int n) |
| 52 | { |
| 53 | // Find the maximum number to know number of digits |
| 54 | int m = getMax(arr, n); |
| 55 | |
| 56 | // Do counting sort for every digit. Note that |
| 57 | // instead of passing digit number, exp is passed. |
| 58 | // exp is 10^i where i is current digit number |
| 59 | for (int exp = 1; m / exp > 0; exp *= 10) |
| 60 | countSort(arr, n, exp); |
| 61 | } |
| 62 | |
| 63 | // A utility function to print an array |
| 64 | static void print(int arr[], int n) |