Skip to content

removeChild in BinaryTreeNode does not remove parent from child #98

@flurmbo

Description

@flurmbo

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();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions