Learn
Practice
Newsletter
Resources
Animations
New
F
Toggle theme
0
F
0
Toggle menu
← Back to All Animations
Binary Search Tree Iterator
Bookmark
Input
Standard
Complete BST
Sparse BST
Custom
tree
=
[7, 3, 15, null, null, 9, 20]
7
3
15
9
20
BSTIterator
stack
output
lazy inorder: stack = path to the next smallest
algo
master
.
io
Step:
Start: the stack lazily holds the path to the next smallest value
0 / 29
Input
Standard
Complete BST
Sparse BST
Custom
tree
=
[7, 3, 15, null, null, 9, 20]
0 / 29
7
3
15
9
20
BSTIterator
stack
output
lazy inorder: stack = path to the next smallest
algo
master
.
io
Step:
Start: the stack lazily holds the path to the next smallest value