public static void inntTreeHungrySort(int[] a) { int prev = a[0]; int ind = 0; InntTree it = new InntTree(); for (int i = 1; i < a.length; i++) { int t = a[i]; if (t == prev) continue; it.put(prev, i - ind); ind = i; prev = t; } it.put(prev, a.length - ind); pasteIntoArray(it, a); }
public static void inntTreeSort(int[] a) { InntTree it = new InntTree(); for (int i : a) it.put(i); pasteIntoArray(it, a); }