2,661 views
1 1 vote
The height of a binary tree is defined as the number of nodes in the longest path form the root node to the leaf node. Let X be the height of complete binary tree with 256 nodes. The value of X will be ______.

1 Answer

Best answer
2 2 votes

@Shaik Masthan Sir, Can we do like this 

number of nodes will be 1,2,4,8,... at each level

now count them it will be 2^n-1

now check for what value of n it will result in >=256

for n=8 it is 255

for n=9 it is >=256

so the height of the tree will be 9.

• selected by
Position:
Show:

Related questions

0 0 votes
1 1 answer
1.7k
1.7k views
himgta asked Jan 30, 2019
1,720 views
We are given a C function, mystery() as follows. void mystery(int m, int n) { while(m<=n) { m++; n ; } }Let X be the number of times the comparission inside the while loo...
2 2 votes
3 3 answers
1.9k
1.9k views
0 0 votes
1 1 answer
757
757 views
balchandar reddy san asked Jan 19, 2019
757 views
Consider a binary tree, where for every node P – Q ≤ 2, where P represents number of nodes in left sub tree for node S and Q represents the number of nodes in right sub t...
0 0 votes
0 0 answers
642
642 views
Shadan Karim asked Jan 13, 2019
642 views