Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Operation at
Binary Search Tree
Didih Rizki Chandranegara
didihrizki@umm.ac.id
key
F, B, A, D, C, E, G, I, H
A, B, C, D, E, F, G, H, I
A, C, E, D, B, H, I, G, F
Minimum/Maximum
Searching
Successor/Predecessor
Since y has a left child, it must be the largest element in the tree
rooted at y->left
If x is not the largest element in the subtree rooted at y->left,
then some ancestor of x (in the subtree) is the left child of its
parent
But y, which is not in this subtree, is the lowest such node
Thus x is the predecessor of y, and y is the successor of x
Insertion
Deletion
Time Complexity
Any Question???
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16