Build challenges · 4 steps · javascript · python

Binary Search Tree

Construct a Binary Search Tree with node pointers, recursive insertion, lookup, in-order traversal, and 3-case deletion.

A Binary Search Tree (BST) is a node-based binary tree where every node satisfies the BST Invariant:

In this build, you will construct a Binary Search Tree from scratch:

  1. Implement ordered node insertion (insert).
  2. Search keys with $O(\log n)$ branching (search).
  3. Traverse keys in sorted order (inOrder) and find extremes (min / max).
  4. Implement recursive 3-case node deletion (delete).

The workspace

These files carry across every step. What you write in one step is what you start the next with.

Steps · 0 of 4 done

  1. BSTNode & Ordered Insertion
  2. Binary Search Lookup
  3. In-Order Traversal & Extremes
  4. Three-Case Node Deletion

Start anywhere. Open step 3 first and you are handed the reference build of steps 1 and 2, so every step stands on its own. Nothing here is locked behind anything else.

This build applies Trees and Recursion & Memoisation. Read the lesson first if it is unfamiliar — a recommendation, not a prerequisite.

Shorter practice on the same ideas