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

removeChild in BinaryTreeNode does not remove parent from child #98

Closed
flurmbo opened this issue Jul 12, 2018 · 1 comment
Closed

removeChild in BinaryTreeNode does not remove parent from child #98

flurmbo opened this issue Jul 12, 2018 · 1 comment

Comments

@flurmbo
Copy link

flurmbo commented Jul 12, 2018

Apologies if this is the expected behavior. In BinaryTreeNode.js, the function removeChild sets either this.left or this.right to null, but does not set nodeToRemove.parent to null. So for example the following test fails:

const rootNode = new BinarySearchTreeNode('foo');
rootNode.insert('bar');
const childNode = rootNode.find('bar');
rootNode.remove('bar');
expect(childNode.parent).toBeNull();
trekhleb added a commit that referenced this issue Jul 13, 2018
@trekhleb
Copy link
Owner

Thanks for noticing that @flurmbo . It is fixed now.

shoredata pushed a commit to shoredata/javascript-algorithms that referenced this issue Mar 28, 2019
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