public void pwcReadjust2(Fnode node1, Fnode node2) { // removes the larger // node from linked // list, make new // child and parents if (node2 == min) { replaceMin(); } removeReference(node2); if (node1.child != null) { node2.right = node1.child.right; node2.left = node1.child; if (node1.child.right == node1.child) { node1.child.left = node2; } else { node1.child.right.left = node2; } node1.child.right = node2; } else { node2.right = node2; node2.left = node2; node1.child = node2; } node2.parent = node1; ary[node1.degree] = null; node1.degree++; node2.cc = false; pwcReadjust(node1); }
public void replaceMin() { Fnode min2 = findMin2(); removeReference(min); min.left = min; min.right = min; min = min2; }
public void insert(Fnode node) { if (min == null) { min = node; min.left = min; min.right = min; } else if (min.left == min) { min.left = node; min.right = node; node.left = min; node.right = min; } else { min.right.left = node; node.right = min.right; min.right = node; node.left = min; } chkMin(node); node.parent = null; }