Find the largest number smaller than a given number(n) in the given BST.
I tried this:
start at root node, check if root equal to n-1. If root is less than n-1 recursively call the method on root.right. If root is more than n-1 recursively call the method on root.left.
This solution works if i have a global variable to keep track to current largest element smaller that n but this is not good solution. Please let me know how to solve without global variable