Question 1: How do you get the depth of a binary tree? Nodes from the root to a leaf form a path. Depth of a binary tree is the maximum length of all paths. For example, the depth of the binary tree in Figure 1 is 4, with the longest path through nodes 1, 2, 5, and 7
Read full article from Coding Interview Questions: No. 35 - Depth of Binary Trees
No comments:
Post a Comment