Binary Search Tree Visualization

Visualize operations on a binary search tree data structure (Max 15 nodes)

Visualization
Visual representation of the binary search tree (0/15 nodes)
Nodes: 0/15
Empty Operation
// Binary Search Tree Operations
// Use the insert operation to add nodes to the tree
insert(value: number) {
const newNode = new TreeNode(value)
if (!this.root) {
this.root = newNode
this.nodeCount++
return { success: true }
}
// ...
}
Operations
Perform operations on the binary search tree
Binary Search Tree Properties

Ordering Property

For each node, all values in the left subtree are less than the node's value, and all values in the right subtree are greater.

Time Complexity

Insert:O(log n) average
Search:O(log n) average
Delete:O(log n) average
Traversal:O(n)

Applications

  • Searching and sorting
  • Priority queues
  • Database indexing
  • Syntax trees in compilers