Skip to content

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

@branlok

Description

@branlok

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions