1
Binary Search Trees
2
Binary Search Trees
! A data structures with efficient support
for many dynamic set operations:
– Search/Find – Minimum/findMin – Maximum/findMax – Predecessor – Successor – Insert – Delete/Remove
! All these operations take time
proportional to the height of the tree.
3
Binary Tree Definition
! A binary-tree that satisfies the binary-
search-tree property:
! Let x be a node in a binary search
- tree. Any node y in the left subtree of
x satisfies: y.key <= x.key Any node y in the right subtree of x satisfies: x.key <= y.key
! Inorder traversal of a binary search
tree visits the node according to the sorted order of their keys.
4