How to Use
- Insert: Enter a value and click "Insert"
- Delete: Enter a value and click "Delete"
- Search: Enter a value and click "Search"
- Random BST: Click to generate a random tree
- Reset: Click to clear the tree
Binary Search Tree Concept
Binary Search Tree (BST) is a binary tree where left child values are smaller than parent, and right child values are larger than parent.
Key Properties:
- Left subtree values < parent value
- Right subtree values > parent value
- In-order traversal gives sorted sequence
- Efficient search, insert, and delete
BST stands for Binary Search Tree, a fundamental data structure that maintains sorted order through its structural properties.
Binary Search Tree Setup
Binary Search Tree Operations
Tree Visualization
(BST maintains sorted order through structure)
Operation Steps
Purpose & Applications
- Database indexing
- File systems
- Expression parsing
- Priority queues
- Sorted data maintenance
Time & Space Complexity
Operation | Average Case | Worst Case |
---|---|---|
Insert | O(log n) | O(n) |
Delete | O(log n) | O(n) |
Search | O(log n) | O(n) |
Space | O(n) | O(n) |
Strengths & Limitations
Strengths:
- Simple implementation
- In-order gives sorted data
- Dynamic size
Limitations:
- Can become unbalanced
- Worst case O(n) operations