private static void sort(Node[] src, Node[] dest, int low, int high) {
        int length = high - low;

        if (length < 7) {
            for (int i = low + 1; i < high; i++)
                for (int j = i, k = i - 1; j > low && (dest[k].weight > dest[j].weight); --j, --k) {
                    Node t = dest[j];
                    dest[j] = dest[k];
                    dest[k] = t;
                }
            return;
        }

        int mid = (low + high) >>> 1;
        sort(dest, src, low, mid);
        sort(dest, src, mid, high);

        for (int i = low, p = low, q = mid; i < high; i++) {
            if (q >= high || p < mid && (src[p].weight <= src[q].weight))
                dest[i] = src[p++];
            else
                dest[i] = src[q++];
        }
    }