Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Chapter 15] Bug - BST remove method isn't performing correctly in removing nodes. #35

Open
branlok opened this issue Sep 14, 2021 · 0 comments

Comments

@branlok
Copy link

branlok commented Sep 14, 2021

BinarySearchTree.prototype.remove fails to remove parent node in the following example.

example

var bst1 = new BinarySearchTree();
bst1.insert(1);
bst1.insert(3);
bst1.insert(2);
console.log(bst1.findNode(3)); // true
console.log(bst1.findNode(5)); // false

bst1.remove(1);
bst1.remove(3);
bst1.remove(2);
console.log(bst1.findNode(1));  // true <-- should be false
branlok added a commit to branlok/js-data-structures-and-algorithms that referenced this issue Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant