Binary Search Tree

A node-based binary tree data structure which has the following properties: The left subtree of a node contains only nodes with keys lesser than the node's key. The right subtree of a node contains only nodes with keys greater than the node's key.

Binary Search Tree

Visualize traversal, comparisons, and the 3 cases of deletion.

Input Action

Decision Log

Ready for next command...

Tree Height

2

Comparisons

0

51015
BST Simulation Engine

Deep Dive: Why Binary Search Trees?

In an ideal (balanced) BST, operations are O(log N) because each comparison eliminates half the remaining nodes. However, if you insert sorted values (Worst-Case Mode), the tree becomes skewed like a linked list, degrading to O(N) performance. This is why techniques like AVL or Red-Black trees are used to keep the height minimal.

Detailed explanation about Binary Search Tree.