687 views

3 Answers

Best answer
0 votes
0 votes
Sum of degrees = (I-1) * 5 + 4 + L (Each internal node except root has degree 5 and root has degree 1) = 5I + 37

So, no. of edges = (5I + 37)/2

No. of nodes = no. of edges + 1

So, L + I - 1 = (5I + 37)/2

3/2I = 37/2

I = 37/3 = 12.33.

So, for 38 leaf nodes we need more than 12 internal nodes, so it must be 13 internal nodes and last level not being fully filled.
selected by
1 votes
1 votes

relationship in any n-ary tree 

I(n-1) + 1 = L  I : intenal node n:n-ary tree L:leaf node

I(4-1)+1=38 
I =12.33 = 13 nodes

 

0 votes
0 votes

let root node beat level 0.

at level 1 leaves = 4 and total nodes = 4+1=5 (including root node)

at level 2 , no. of leaves = 4*4 =16and total nodes =16+4+1=21.

at level 3 not all of the 16 leaves become interior nodes.Some have children and some are left as leaves. because if all have children, then total leaves become 4*4*4=64>38, the given number.

at level 3, among 16 leaves ,

nodes=5,

leaves = 16

for( i=1 to 16, leaves<38, i++) 

{

nodes=5+i;

leaves=4+ leaves-1

}

nodes=5+i leaves(n)=4+leaves(n-1)-1
1 4
4+1=5 16
6 4+16-1
7 22
8 25
9 28
10 31
11 34
12 37
13 40

print node. This gives 13.

Related questions

0 votes
0 votes
1 answer
1
Salazar asked Jan 29, 2018
3,960 views
Maximum height of a B+ tree of order m with n key values is (With Derivation), the answer is known Logceil(m/2) NI tried deriving but had some trouble, could someone assi...
0 votes
0 votes
1 answer
3
sripo asked Nov 8, 2018
670 views
For a heap containing n elements,smallest element can be found in n/2 operations.I always get confused and think as logn operations.Please help me differentiating between...
1 votes
1 votes
0 answers
4
Rohit Gupta 8 asked Dec 25, 2017
1,142 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}))$