Search in Binary Search Tree L:
- Compare X to the root (i.e. middle value) (M)
- if X = M we are done.
- if X < M we recursively search for X in L's left subtree.
- if X > M we recursively search for X in L's right subtree.
Example: search for 5 in earlier tree.
It is easy to traverse a BST in increasing order. From the node
containing the value N
This is left-to-right infix traversal.
- process all values smaller than N - i.e. traverse N's left
- process N itself.
- process all values bigger than N - i.e. traverse N's right
How to traverse a BST in decreasing order?
Answer: right-to-left infix traversal.