We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e3f7bd5 commit 46dae59Copy full SHA for 46dae59
leetcode/medium/094_binary_tree_inorder_traversal.md
@@ -2,9 +2,9 @@
2
3
## Recursive solution
4
- Runtime: O(N)
5
-- Space: O(D)
+- Space: O(H)
6
- N = Number of elements in tree
7
-- D = Depth of Tree
+- H = Height of tree
8
9
Inorder traversal is left -> node -> right.
10
@@ -28,9 +28,9 @@ class Solution:
28
29
## Iterative solution
30
31
32
33
34
35
By using a stack, we mimic what the computer would do when it does this recursively.
36
The current node is used to traverse the tree while the stack is used when we need to backtrack to the previous node.
0 commit comments