algo_059.md (353B)
1 # algo_059 2 3 ### Problem Statement 4 5 > Write an algorithm to find the inorder successor of a node in a Binary Search Tree (BST). 6 7 ## Algorithm 8 ``` 9 procedure inorderSuccessor(ptr) 10 begin 11 /* Finds the leftmost node of the right subtree */ 12 p ← RC(ptr); 13 while (LC(p) ≠ NULL) do 14 p ← LC(p); 15 endwhile 16 return p; 17 end procedure 18 ```