DSA · Reimagined
Trees hard time O(h) space O(1)

BST — Delete

Deleting from a BST has three cases. A leaf just detaches. A node with one child is replaced by that child. A node with two children is trickier: copy in its in-order successor (the smallest key on its right) and delete that instead.

50302045706085

Delete 30 from the tree.

1 / 7

Practice

Machine twin: /dsa-viz-v2/bst-delete.json — the full deterministic run as structured data.