Skip to content
DSA Visualizerpreview

Binary search tree: delete

Three cases: a leaf goes, a single child moves up, two children borrow the successor's value.

O(h) time · O(h) space

Values50, 30, 70, 20, 40, 60, 80, 65delete 70

Delete 70 from the tree built from 50, 30, 70, 20, 40, 60, 80, 65.

Tree with 8 nodes; in order: 20, 30, 40, 50, 60, 65, 70, 80.
  • compare
  • swap or write
  • settled

1 / 6

Speed

Space play · ← → step · Home End jump · drag the strip to scrub