CAB301 - Algorithms and Complexity
School of Computer Science, Faculty of Science
Each node has at most two children: left and right.
In a Binary Search Tree (BST), for each node:
Any operation must maintain the BST property.
In-order: Left, Root, Right Run
Pre-order: Root, Left, Right Run
Post-order: Left, Right, Root Run
Search is similar to Binary Search:
ALGORITHM Search(, ) if if return else if return Search(, ) else return Search(, ) else return
Insertion is similar to Search:
ALGORITHM Insert(, ) if new Node; ; else if if new Node else else if new Node else
Insert
Deletion is more complex:
Delete