-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
else if (tree.right == null || tree.right.phantomLeaf)
{
this.cmd("SetText", 0,"Node to delete has no right child. \nSet parent of deleted node to left child of deleted node.");
if (tree.right != null)
{
this.cmd("Delete", tree.right.graphicID);
tree.right = null;
}
if (tree.parent != null)
{
this.cmd("Disconnect", tree.parent.graphicID, tree.graphicID);
this.cmd("Connect", tree.parent.graphicID, tree.left.graphicID, LINK_COLOR);
this.cmd("Step");
this.cmd("Delete", tree.graphicID);
if (leftchild)
{
tree.parent.left = tree.left;
if (needFix)
{
tree.parent.left.blackLevel++;
this.fixNodeColor(tree.parent.left);
this.fixExtraBlack(tree.parent.left);
this.resizeTree();
}
else
{
this.cmd("SetText", 0, "Deleted node was red. No tree rotations required.");
this.resizeTree();
}
}
else
{
tree.parent.right = tree.left;
if (needFix)
{
tree.parent.right.blackLevel++;
this.fixNodeColor(tree.parent.right);
this.fixExtraBlack(tree.parent.left); // here is my question.
this.resizeTree();
}
else
{
this.cmd("SetText", 0, "Deleted node was red. No tree rotations required.");
this.resizeTree();
}
}
tree.left.parent = tree.parent;
}
else
{
this.cmd("Delete" , tree.graphicID);
this.treeRoot = tree.left;
this.treeRoot.parent = null;
if (this.treeRoot.blackLevel == 0)
{
this.treeRoot.blackLevel = 1;
this.fixNodeColor(this.treeRoot);
}
}
}//In 1145 line, Why the code is this.fixExtraBlack(tree.parent.left);
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels