Skip to content

Commit 46dae59

Browse files
author
Joseph Luce
authored
Update 094_binary_tree_inorder_traversal.md
1 parent e3f7bd5 commit 46dae59

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

leetcode/medium/094_binary_tree_inorder_traversal.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
## Recursive solution
44
- Runtime: O(N)
5-
- Space: O(D)
5+
- Space: O(H)
66
- N = Number of elements in tree
7-
- D = Depth of Tree
7+
- H = Height of tree
88

99
Inorder traversal is left -> node -> right.
1010

@@ -28,9 +28,9 @@ class Solution:
2828

2929
## Iterative solution
3030
- Runtime: O(N)
31-
- Space: O(D)
31+
- Space: O(H)
3232
- N = Number of elements in tree
33-
- D = Depth of Tree
33+
- H = Height of tree
3434

3535
By using a stack, we mimic what the computer would do when it does this recursively.
3636
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

Comments
 (0)