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 upgradeChild() { Fnode temp = min.child; min.child = null; /* * while(temp.right!=null){ Fnode temp2 = temp.right; * removeReference(temp); insert(temp); temp = temp2; temp } */ while (temp != null) { if (temp.right != temp) { Fnode temp2 = temp.right; removeReference(temp); insert(temp); temp = temp2; } else { insert(temp); temp.parent = null; temp = null; } } }