Skip to content

Commit 9f468c2

Browse files
ClémentClément
authored andcommitted
Clarifying depth and height.
1 parent e277fd5 commit 9f468c2

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

source/lectures/data/trees.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ However, only the root knows its depth (it is $0$), all the other nodes do not k
9393
Of course, if the `BTree` is `null`, then deciding its height is easy: it is -1.
9494
If its `root` has $0$ children, then it is 0.
9595
But otherwise, we need to ask the children their depths, take the maximum, and add 1 to it.
96-
For this, we will use *recursion*.
96+
For this, we will use *recursion* in the `ComputeMaxDepth` method below, that we discuss first.
9797

98-
In short, for a node to determine its depth, it needs to
98+
In short, we need to
9999

100-
- Have its `root` "ask its children" what their deepest node is,
100+
- Have the `root` node "ask its children" what their deepest node is,
101101
- Take the maximum value returned, and add 1 to it.
102102

103103
For the `root`'s children to determine what the deepest node under them is, they need both to

0 commit comments

Comments
 (0)