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

BSTree.remove() will not remove the root node? #7

Open
recursion opened this issue Dec 16, 2015 · 1 comment
Open

BSTree.remove() will not remove the root node? #7

recursion opened this issue Dec 16, 2015 · 1 comment

Comments

@recursion
Copy link

Im not sure if this is expected behavior or not? I noticed that BSTree.remove() will not remove the node if it is the last one/root node in the tree?

assuming:

var tree = new BSTree();
// tree._count = 0

tree = tree.insert(100, 'yay');
//tree._count = 1

tree = tree.remove(100);
//tree._count = 1 (expecting 0)

It appears that the BSTree will not remove the root node once one has been added. Is this correct/expected behavior?

Thanks!

@Cfeusier
Copy link
Contributor

_count should go to 0, and the root should be set to null -- unless @sdtsui disagrees.

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

2 participants