Trees & SearchD2Phase 3treeinsertdeletesearch

BST Operations

Binary search tree insertion, lookup, and deletion walkthroughs.

Easy Explanation

BST operations follow left-smaller and right-larger rules to search, insert, and delete values efficiently.

Visualizer
O(1)BST Operations
Deterministic BST playback for search, insert, and delete with explicit traversal and structural relink events.

Operations

0

Tree

0 nodes / h=0

Progress

t:0 s:0

Mutations

i:0 d:0

Ready

Press Play or Step to start execution.

Initial Tree

empty

Current Frame

empty

Final Output

empty

Current Operation

n/a

Script

n/a

Tree is empty. Add initial values or randomize to generate a run.
currentstructural change
BST Operations Implementation
Pseudocode + TypeScript
Reference implementation examples are intentionally abstracted from the playback engine so learners can map concepts to code.
pseudocode
function search(node, target):
  while node is not null:
    if target == node.value:
      return node
    if target < node.value:
      node <- node.left
    else:
      node <- node.right
  return null

function insert(node, value):
  if node is null:
    return new Node(value)
  if value < node.value:
    node.left <- insert(node.left, value)
  else if value > node.value:
    node.right <- insert(node.right, value)
  return node
1.00xNo Run