You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hint 1
The inorder traversal of a BST gives us the elements in a sorted order.
Hint 2
We can use a stack to simulate the inorder traversal of the BST.
Hint 3
We can use another stack as a buffer to store numbers returned from calls to next and use this buffer whenever prev is called.