Skip to content

Commit 8cf00a7

Browse files
committed
illustrate binary tree
1 parent 2829f8c commit 8cf00a7

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

146 KB
Binary file not shown.

images/trees/TreeTerminology.pdn

177 KB
Binary file not shown.

src/binary_tree.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@ namespace cs
174174
int Height() const { return height; }
175175

176176
// Returns the balance factor of this node.
177-
// Balance factor of a node is the difference between its right and the left subtrees.
177+
// Balance factor of a node is the difference between the heights
178+
// of its right and the left subtrees.
178179
// This method is supposed to be called by the friend classes (trees).
179180
int BalanceFactor() const
180181
{
@@ -445,7 +446,8 @@ namespace cs
445446
/**
446447
* @brief Calculates the height of a tree rooted in @p root node.
447448
* Height of a tree is the maximal number of edges in a path from
448-
* its root to any of its leaves.
449+
* its root to any of its leaves. Thus, a tree comprised of just
450+
* a single node has the height equal to 0.
449451
*
450452
* @param root - tree root.
451453
*

0 commit comments

Comments
 (0)