Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Convert BST to Sorted Doubly Linked List
Bookmark
Collect + Link
Recursive In-Place
Iterative Stack
Input
Balanced BST
Simple
Right Skewed
Custom
tree
=
[4, 2, 5, 1, 3]
4
2
5
1
3
Sorted Doubly Linked List
empty
Current
On stack
Linked
4
2
5
1
3
Sorted Doubly Linked List
empty
Current
On stack
Linked
4
2
5
1
3
current
Sorted Doubly Linked List
empty
Current
On stack
Linked
4
2
5
1
3
current
Sorted Doubly Linked List
1
Current
On stack
Linked
4
2
5
1
3
current
Sorted Doubly Linked List
1
2
Current
On stack
Linked
4
2
5
1
3
current
Sorted Doubly Linked List
1
2
3
Current
On stack
Linked
4
2
5
1
3
current
Sorted Doubly Linked List
1
2
3
4
Current
On stack
Linked
4
2
5
1
3
current
Sorted Doubly Linked List
1
2
3
4
Current
On stack
Linked
4
2
5
1
3
Sorted Doubly Linked List
1
2
3
4
5
Current
On stack
Linked
4
2
5
1
3
Sorted Doubly Linked List
1
2
3
4
5
Current
On stack
Linked
4
2
5
1
3
Sorted Doubly Linked List
1
2
3
4
5
circular
Current
On stack
Linked
algo
master
.
io
Step:
nodes = [] (collect the sorted order first)
0 / 29
Input
Balanced BST
Simple
Right Skewed
Custom
tree
=
[4, 2, 5, 1, 3]
0 / 29
algo
master
.
io
Step:
nodes = [] (collect the sorted order first)