MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / radixsort

Method radixsort

Java/RadixSort.java:51–61  ·  view source on GitHub ↗
(int arr[], int n)

Source from the content-addressed store, hash-verified

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)

Callers 1

mainMethod · 0.95

Calls 2

getMaxMethod · 0.95
countSortMethod · 0.95

Tested by

no test coverage detected