• edited by
6,794 views
11 11 votes

Of the following, which best approximates the ratio of the number of nonterminal nodes in the total number of nodes in a complete $K$-ary tree of depth $N$ ?

  1. $1/N$
  2. $N-1/N$
  3. $1/K$
  4. $K-1/K$

5 Answers

11 11 votes

Considering Full k-ary tree of depth N: (i.e. all nodes present from depth $0$ to $N-1$)

$\frac{Non-Terminal Nodes}{Total Nodes} = \frac{1+k + k^2+...k^{(N-2)}}{1+k + k^2+...k^{(N-1)}}=\frac{k^{(N-1)}-1}{k^{(N)}-1} \cong \frac{1}{K}$

Considering minimally complete k-ary tree of depth N: (i.e. all nodes present from depth $0$ to $N-2$ & one node in depth $N-1$)

$\frac{Non-Terminal Nodes}{Total Nodes} = \frac{1+k + k^2+...k^{(N-3)}+1}{1+k + k^2+...k^{(N-2)}+1}=\frac{k^{(N-2)}-1+k-1}{k^{(N-1)}-1+k-1} =\frac{k^{(N-2)}+k-2}{k^{(N-1)}+k-2} \cong \frac{1}{K}$

So answer will be (c) $\frac{1}{K}$

2 2 votes
$\underline{\textbf{Answer:}\Rightarrow}\;\mathbf{c.}$

For a given $\mathrm{k-ary}$ tree with height $\mathrm N$

Total number of nodes $\mathrm{=\left ( \dfrac{K^{N+1-1}}{K-1} \right )}$

Total Nodes = Non-Leaf Nodes + Leaf Nodes.

Leaf Nodes = $\mathrm{\mathbf{N^{th}}}$ level nodes $\mathrm{=K^N}$

$\therefore $Non Leaf = Total Nodes– Leaf Nodes

$\mathrm{=\dfrac{K^{N+1}-1}{K-1}-K^N = \left ( \dfrac{K^N-1}{K-1}\right )}$

$\therefore \mathrm{\dfrac{Non Leaf}{Total}=\dfrac{\dfrac{K^N-1}{K-1}}{\dfrac{K^{N+1}}{K-1}}}=\dfrac{K^N-1}{K\left (K^N-\dfrac{1}{K}\right )}$

Now, if $\mathrm k\to \infty$, then $\mathrm{K^N-\dfrac{1}{K} = K^N = \dfrac{K^N-1}{K(K^N)} = \dfrac{1}{k}\bigg [1-\dfrac{1}{K^N}\bigg ]\approx \dfrac{1}{K}}$
• edited by
1 1 vote
No. of leaf nodes = no.of non terminal nodes(K-1)+1

no. of leaf nodes = $K^N$

so, no. of non terminal nodes = $\frac{K^N-1}{K-1}$ (Using the above formula)-----1

Total nodes = $\frac{K^N-1}{K-1} +K^N=\frac{K^{N+1}-1}{K-1}$-----2

 Divide 1 and 2 we get approx result $1/K$ (Put N=3 and K=2 you will get the approx result as1/2)
• edited by
0 0 votes

K-array : A rooted tree in which each node have either 0 or K child.

let S be the number of nodes in the tree;

 

Every roted tree have following properties

$indegree=outdegree=S-1$

 

$outdeg(L) + outdeg(I) = S - 1$

$L$ : leaf nodes

$I$: internal nodes

 

we know outgdegree of leaf nodes is 0, so

$K . D^K = S - 1$, let $D^K$ be the number of internal nodes

$D^K = \frac{S - 1}{K}$

 

$ratio = \frac{\frac{S - 1}{K}}{S} = \frac{S - 1}{S . K} = \frac{S (1 - \frac{1}{S})}{K. S} = \frac{(1 - \frac{1}{S})}{K} \approx  \frac{1}{K}$

 

for $S = 1$ it is not defined beacause if tree have only 1 node then it must $0$ outdegree

 

 

 

Answer:
Position:
Show:

Related questions

4 4 votes
5 5 answers
8.4k
8.4k views
Satbir asked Jan 13, 2020
8,438 views
$G$ is an undirected graph with vertex set $\{v1, \ v2, \ v3, \ v4, \ v5, \ v6, \ v7\}$ and edge set $\{v1v2,\ v1v3,\ v1v4\ ,v2v4,\ v2v5,\ v3v4,\ v4v5,\ v4v6,\ v5v6,\ v6v...
6 6 votes
5 5 answers
6.4k
6.4k views
Satbir asked Jan 13, 2020
6,401 views
Convert the pre-fix expression to in-fix $- ^{\ast} +ABC^{\ast} – DE+FG$$(A-B)^{\ast}C+(D^{\ast}E)-(F+G)$$(A+B)^{\ast}C-(D-E)^{\ast}(F+G)$$(A+B-C)^{\ast}(D-E)^{\ast}(F+G)...
9 9 votes
4 4 answers
11.3k
11.3k views
Satbir asked Jan 13, 2020
11,300 views
The minimum height of an AVL tree with $n$ nodes is$\text{Ceil } (\log_2(n+1))$$1.44\ \log_2n$$\text{Floor } (\log_2(n+1))$$1.64\ \log_2n$
6 6 votes
4 4 answers
7.1k
7.1k views
Satbir asked Jan 13, 2020
7,140 views
A stack is implemented with an array of $’A[0...N-1]’$ and a variable ‘$pos$’. The push and pop operations are defined by the following code.push (x) A[pos] <- x pos <- p...