trekhleb / trekhleb/javascript-algorithms

BinarySearchTreeNode removing

Open Beginner friendly
#2,102 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
197k
Forks
31k
PR merge metrics
No merged PRs in 30d

Description

Have found an issue in the remove method
Run this test to reproduce

it.only('should remove nodes', () => {
const root = new BinarySearchTreeNode(8);
root.insert(3);
root.insert(6);
root.remove(3);
root.remove(6);
expect(root.right).toBeNull();
expect(root.left).toBeNull();
});

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Search the repository for the BinarySearchTreeNode class and its remove method, then run the supplied “should remove nodes” test to reproduce the issue. Trace the removals of 3 and 6 from a root of 8, and consider the work done when the test passes with both root.left and root.right null.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.