4 votes 4 votes What's the difference between Binary tree height, level and depth? Sometimes it's confusing! Does there definition change according to question also, if mentioned? DS data-structures binary-tree + – Shashank Chavan asked Jan 18, 2016 • edited Jan 18, 2016 by Shashank Chavan Shashank Chavan 11.3k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
Best answer 4 votes 4 votes Actually, the terms would be defined in question itself. But generally, we define them as follows: The height of any node is the distance of the node form the root. The depth of the node is the distance of the node from the leaf to that node.Level starts from the root node. (In question, they define whether level starts from 0 or 1). monanshi answered Jan 18, 2016 • selected Jan 18, 2016 by Pooja Palod monanshi comment Share Follow See all 2 Comments See all 2 2 Comments reply Arjun commented Jan 18, 2016 reply Follow Share Yes, reading question is the key :) And if not defined in question, see options. 1 votes 1 votes kapilbk1996 commented Aug 7, 2017 reply Follow Share The depth of a node is the number of edges from the node to the tree's root node. A root node will have a depth of 0. The height of a node is the number of edges on the longest path from the node to a leaf. A leaf node will have a height of 0. 1 votes 1 votes Please log in or register to add a comment.