fix implicit global var in bst.
This commit is contained in:
parent
2163e3965e
commit
ad7ef10343
@ -139,17 +139,17 @@ BST.prototype.remove = function remove(key, options) {
|
||||
|
||||
if (!current.left || !current.right) {
|
||||
if (current.left)
|
||||
child = current.left;
|
||||
current = current.left;
|
||||
else
|
||||
child = current.right;
|
||||
current = current.right;
|
||||
|
||||
if (!parent) {
|
||||
this.root = child;
|
||||
this.root = current;
|
||||
} else {
|
||||
if (left)
|
||||
parent.left = child;
|
||||
parent.left = current;
|
||||
else
|
||||
parent.right = child;
|
||||
parent.right = current;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user