04 Try it yourself Interactive

Descend the tree, then delete a node

Press Next one step at a time. Amber nodes are the path you have already walked, the indigo ring is the node you are standing on, a rose ring marks the node whose empty link the walk fell off, and the row under the tree is the inorder walk of the tree as it stands right now. Switch to Delete and the console names which of the three cases your value hits, then restructures in front of you. The insert order you type is what decides the shape, so try a sorted list.

Search, then insert if missing
one comparison per level
2–9 whole numbers (0–99). The order you type them is the insert order.

Inorder walk of the tree right now. Every completed operation leaves it strictly increasing — the one step where a value shows up twice is mid-delete, while the successor is being copied up.

Press Next to begin. Each press moves one step.


      
At node
Candidates
Nodes in tree0
Comparisons0
step 0 / 0