edited by
1,287 views
1 votes
1 votes
The height of a binary tree is defined as the number of nodes in the longest path from root to the leaf node. Let X be the height of a complete binary tree with 256 nodes. Then the value of X will be
Answer 9
edited by

1 Answer

2 votes
2 votes

Read carefully what it is saying :- The height of a binary tree is defined as the number of nodes in the longest path from root to the leaf node. i.e. if node is 3 with (height 2) then height = 3 (a/c to question).

basically it is saying with node = 1 height = 1.

now, for complete binary tree h= ceil(log(n+1)-1) [with height starting from h=0 with node=1.]

ceil(log(256+1)-1=8

hence for this question 8+1= 9.

Related questions

1 votes
1 votes
0 answers
1
Rohit Gupta 8 asked Dec 25, 2017
1,109 views
If the average depth of a node in an $n$-node binary search tree is $O(\log{n})$, then the height of the tree is$O(n\log{n})$$O(n)$$O(\log{n})$$O(\sqrt(n\log{n}))$
0 votes
0 votes
1 answer
2
saipriyab asked Nov 27, 2017
436 views
For the height of the tree for gate what should we consider the number of edges from the root the leaf or number of levels.????
0 votes
0 votes
2 answers
3
Aman Bisht asked Jun 12, 2017
1,100 views
The height of a binary tree having 'i' nodes at level 'i' considering root to be at level 1 is . where 'n' is the total no of nodes in the tree.A. O(logn)B. O(n)C. O(R...
4 votes
4 votes
1 answer
4