private void consolidate() {

    // Initialize array by making each entry NIL.
    int arraySize = ((int) Math.floor(Math.log(n) * oneOverLogPhi)) + 1;
    Entry array[] = new Entry[arraySize];

    if (min != null) {
      for (Entry w : min.nodelist()) {

        // Find two roots x and y in the root list with the same degree,
        // where key[x]<=key[y].
        Entry x = w;
        int d = w.degree;
        while (array[d] != null) {
          Entry y = array[d];

          // Whichever of x and y has he smaller key becomes the parent of
          // the other.
          if (x.key > y.key) {
            Entry tmp = x;
            x = y;
            y = tmp;
          }
          // Remove y from the root list, and make y a child of x.
          link(y, x);

          // Because node y is no longer a root, the pointer to it in the
          // array is removed.
          array[d] = null;

          // Restore the invariant.
          d++;
        }
        array[d] = x;
      }
    }

    // Empty the root list.
    min = null;

    // Reconstruct the root list from the array.
    for (int i = 0; i < array.length; i++) {
      if (array[i] != null) {
        min = concatenateNode(min, array[i]);
        if (min == null || array[i].key < min.key) {
          min = array[i];
        }
      }
    }
  }