16,679 views
37 37 votes

The total external path length, $\text{EPL},$ of a binary tree with $n$ external nodes is, $\text{EPL}= \displaystyle \sum_{w} I_w$, where $I_{w}$ is the path length of external node $w$),

  1. $\leq n^{2}$ always.
  2. $\geq n \log_{2} n$ always.
  3. Equal to $n^{2}$ always.
  4. $O(n)$ for some special trees.

6 Answers

Best answer
41 41 votes

Here, $n$ denotes the number of external (leaf) nodes and not the total number of nodes.

  1. By adding an edge to the root of a skewed binary tree of say $10$ nodes, we get a binary tree of $11$ nodes having $2$ external nodes of path lengths $9$ and $1$ respectively giving $\text{EPL} = 9+1 = 10 > 2^2.$ So, option A is false.
  2. This is always TRUE. The minimum $\text{EPL}$ for a given number of external nodes $n$ happens for a full binary tree. In this case when we have $n$ external nodes and $(2n-1)$ total nodes and each external node will have a path length of $\log_2 (2n-1)$ giving total external path length, $\text{EPL} = n \log_2 (2n-1).$ Now, if we try to add any amount of skeweness to this full binary tree we can see that $\text{EPL} > n \log_2 (2n-1).$
  3. False as shown for option A.
  4. False as shown for option B.

Correct option: B.

• edited by
7 7 votes
Here the question asked for binary tree

It can be of 2 types (1) skewed tree (2) Balanced binary tree or AVL tree

We have to find external path length i.e. leaf node

We also know cost of external path = leaf node value * lenth of path

Now for balanced tree external path length=$n\times log n$

But for skewed tree it will be $O\left ( n \right )$ only

So, ans will be D)
4 4 votes
option A isn't right . Here's a counter example , imagine a skewed tree with 2 leaf nodes right at the end of the chain eg;

Node1 - Node2 - Node3 - Node4 - Node5 -  leaf 1

                                                                         |- leaf2

 

here EPL is 10 with 2 external nodes or leaf nodes and it's greater than 4
1 1 vote

Main point: n is the number of external nodes

Option A:

       Cant be the answer. Take an example binary tree with height 2, it will have min 3 nodes(left skew), n=1(leaf), sum of Iw = 2

Option C:

       From above example, not true.

Option D: 

       If a tree has 2 nodes, n = 1 and Iw = 1. It holds true

Option B:

       This always works….then why is it not the answer?

(B,D)

• edited by
0 0 votes
External node means leaf.

a binary tree has at most n/2 Leaves. Means at most or order n.

the length of path from root to leaf is at most log(n)

summing over all such nodes gives nlog(n) Lower bound. Option B

this can be always less than order n squared in the worst case. Option A.

 

option C is not possible because it can be less than that.

Option D is not possible because it is always greater than order n.
• reshown by
Answer:
Position:
Show:

Related questions

32 32 votes
2 answers 2 answers
10.5k
10.5k views
Misbah Ghaya asked Nov 19, 2016
10,542 views
The number of rooted binary trees with $n$ nodes is,Equal to the number of ways of multiplying $(n+1)$ matrices.Equal to the number of ways of arranging $n$ out of $2 n$ ...
16 16 votes
5 answers 5 answers
7.1k
7.1k views
go_editor asked Feb 12, 2018
7,135 views
A $32$-bit floating-point number is represented by a $7$-bit signed exponent, and a $24$-bit fractional mantissa. The base of the scale factor is $16,$The range of the ex...
5 5 votes
3 3 answers
3.9k
3.9k views
Misbah Ghaya asked Nov 23, 2016
3,854 views
State whether the following statements are TRUE or FALSE with reason:Transferring data in blocks from the main memory to the cache memory enables an interleaved main memo...
20 20 votes
2 answers 2 answers
6.4k
6.4k views
Misbah Ghaya asked Nov 19, 2016
6,350 views
Match the pairs in the following questions:$$\begin{array}{|ll|ll|}\hline (a) & \text{Secondary index} & (p) & \text{Function dependency} \\\hline (b) & \text{Non-proced...