本文共 541 字,大约阅读时间需要 1 分钟。
public static void radixSort(int[] arr, int d) { int i; // current digit found by dividing by 10^power int power = 1; // allocate 10 null references to a LinkedQueue LinkedQueue[] digitQueue = new LinkedQueue[10]; // initialize each element of digitQueue to be // an empty queue for (i=0;i < digitQueue.length;i++) digitQueue[i] = new LinkedQueue(); for (i=0;i < d;i++) { distribute(arr, digitQueue, power); collect(digitQueue, arr); power *= 10; } }
转载地址:http://lqboi.baihongyu.com/