天天看点

[LeetCode]173.Binary Search Tree Iterator

implement an iterator over a binary search tree (bst). your iterator will be initialized with the root node of a bst.

calling <code>next()</code> will return the next smallest number in the bst.

note: <code>next()</code> and <code>hasnext()</code> should

run in average o(1) time and uses o(h) memory, where h is the height of the tree.

中序遍历

[LeetCode]173.Binary Search Tree Iterator