Binary Search Tree Visualization

A Binary Search Tree (BST) is a tree data structure in which each node has at most two children, and the values of all nodes in the left subtree are less than the parent node, while values in the right subtree are greater.

BST Operations

Insertion: Add a new node to the tree while maintaining the BST property.

Deletion: Remove a node from the tree. There are three cases:

  • Node with no children: Simply remove the node.
  • Node with one child: Replace the node with its child.
  • Node with two children: Find the inorder successor or predecessor to replace the node.

Search: Find a node with a specific value by traversing the tree.