The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+2 votes
164 views
What is the difference between height and levels for a tree. What will be the value of height and level for root node and why?
asked in Algorithms by (369 points) | 164 views

1 Answer

0 votes
Height and level of a tree are equal.

but height and level of a node are not equal because...

the height is calculated by traversing from leaf to the given node

level is calculated from traversal from root to the given node

that means the height of leaves is 0 and the level of root is 0.
answered by Junior (585 points)
Consider visiting d link mentioned below. I hope d descp helps u. :)
http://typeocaml.com/2014/11/26/height-depth-and-level-of-a-tree/
yeah nicely explained. liked the Groot :p
@s9k96, consider referring Data Structures by Yahwant Kanetkar. Okay. :). Superb book. If possible get d animated slides it'll be help to u. :)

Related questions



Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

29,157 questions
36,985 answers
92,166 comments
34,824 users