Freelance C++ Software Engineer (1998–present) · Author has 3.6K answers and 2.5M answer views · 4y ·
The level of a node is its distance (each edge counts as 1) to the root node. So the root node has level 0, its direct children have level 1 etc.
The height of the tree is the level of the node(s) with the longest path to to root. Stated differently, the height is the maximum of all levels.
By making appropriate changes above, it is possible to start with the root as having level 1 instead of 0.
In both cases (when starting with 0 or 1) a child node always has a level that is 1 higher than it’s parent node.
1.7K views ·
View upvotes
· View 1 share
· 1 of 2 answers
Something went wrong. Wait a moment and try again.