Concept Flow - BST Inorder Predecessor
Start at root
Search for node with given key
Node found?
No→Return nil (no predecessor)
Yes
Does node have left child?
Yes→Go to left child
Go to rightmost node in left subtree
This is inorder predecessor
No
Go up to ancestor where node is in right subtree
That ancestor is inorder predecessor
Return predecessor node
Find the node with the given key, then find its inorder predecessor by either going to the rightmost node in its left subtree or moving up to the nearest ancestor where the node is in the right subtree.