BST Iterator
next() will return the smallest number in BST. Calling next() again will return the next smallest number in the BST, and so on.Using Recursive Inorder Traversal
Construct the inorder of the given tree and store it into a vector. Keep an index variable to point at the elements in this vector.
Time Complexity: β
Space Complexity:
Using Stack
Time Complexity: β
Space Complexity:
Last updated