search
Log In
1 vote
1.3k views

In a complete binary tree of n nodes, how far are the two most distant nodes ? Assume each edge in the path counts as !

  1. About $\log_{2} n$
  2. About $2 \log_{2} n$
  3. About $n \log_{2} n$
  4. About $2n$
in DS
recategorized by
1.3k views
0
why not 2$\log n$

1 Answer

2 votes
If one node is present at extreme left side of the leaves and other node at the other extreme right side of the leaves ,then these two nodes have to cover up height 2 times .From extreme left to root and then from root to Extreme right .

Height of Binary tree$= \log_{2}n$

so Answer is $= \log_{2}n$ + $ \log_{2}n$ =$2 \log_{2}n$
0
Yes, although no need to be in extreme corner. just need to be at the last layer.
0

Yep it makes sense for complete binary tree 

0
@sourav,How wud the diagram for the above question will be drawn?
0

Distance between $H \rightarrow O$ or $I \rightarrow O$

1
@sourav,Thanks. :)
1

Devshree Dubey you are welcome!

Related questions

1 vote
3 answers
1
678 views
Which of the following expression is represented by the parse tree ? $(A + B) ^{*} C$ $A + ^{*} BC$ $A + B * C$ $A * C + B$
asked Sep 16, 2016 in DS makhdoom ghaya 678 views
1 vote
2 answers
2
1.6k views
In a $B$ tree of order $5$, the following keys are inserted as follows : $7, 8, 1, 4, 13, 20, 2, 6$ and $5$ How many elements are present in the root of the tree ? $1$ $2$ $3$ $4$
asked Sep 16, 2016 in DS makhdoom ghaya 1.6k views
0 votes
3 answers
3
812 views
A chained hash table has an array size of $100$. What is the maximum number of entries that can be placed in the table ? $100$ $200$ $10000$ There is no upper limit
asked Sep 16, 2016 in DS makhdoom ghaya 812 views
0 votes
1 answer
4
759 views
What is the most appropriate data structure to implement a priority queue ? Heap Circular array Linked list Binary tree
asked Sep 16, 2016 in DS makhdoom ghaya 759 views
...