Binary Search Tree
A Binary Search Tree is a binary tree that maintains an ordering invariant. For a node, values in the left subtree are smaller and values in the right subtree are larger, assuming the implementation does not allow duplicates. This ordering enables efficient search, insertion, and deletion when the tree remains balanced.
Left subtree contains smaller values.
Right subtree contains larger values.
Inorder traversal produces sorted order.
Search, insertion, and deletion are O(h), where h is tree height.
For a balanced BST, these operations are typically O(log n).
For a highly skewed BST, they can degrade to O(n).
0-2 years experience
2-5 years experience
5-8 years experience
8+ years experience