0100. Same Tree
Easy — Tree, DFS, BFS
← 0099. Recover BST
Recursive DFS
Iterative BFS (Queue)
Iterative DFS (Stack)
p =
q =
Apply
🎲 Generate
Depth:
2
3
4
Mode:
Same
Different
Random
▶ Play
▮▮ Pause
⏭ Step
↺ Reset
Speed:
Slow
Normal
Fast
Very Fast
▶ Press "Play" or "Step" to walk through the comparison.
Step
0 / 0
Comparisons
0
Time
—
Space
—
Default
Comparing
Match
Mismatch
Visited
Null
Algorithm Complexity
Recursive DFS
O(n)
O(n) / O(h)
Iterative BFS
O(n)
O(n) / O(w)
Iterative DFS
O(n)
O(n) / O(h)