algo_059
Problem Statement
Problem Statement
Write an algorithm to find the inorder successor of a node in a Binary Search Tree (BST).
Algorithm
procedure inorderSuccessor(ptr)
begin
/* Finds the leftmost node of the right subtree */
p ← RC(ptr);
while (LC(p) ≠ NULL) do
p ← LC(p);
endwhile
return p;
end procedure1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9