Advertisement
Aldin-SXR

public radix sort()

Apr 24th, 2020
331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.22 KB | None | 0 0
  1. /* Radix sort algorithm (public invocation) */
  2. public static void sort(int[] elements) {
  3.     int max = getMax(elements);                         // 1
  4.        
  5.     for (int exp = 1; max / exp > 0; exp *= 10) {       // 2
  6.         sort(elements, exp);                            // 3
  7.     }
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement