Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
+1 vote
527 views
in Information Technology by (115k points)
closed by
A binary tree T has 20 leaves. The number of nodes in T having two children is _______.

1 Answer

0 votes
by (152k points)
selected by
 
Best answer

CASE I: Root node with two children (degree 2)

∑di = 2 × 1 + i1 × 2 + i2 × 3 + l × 1

where i1 is the number of internal nodes with one child (degree2) and i2 is the number of internal nodes with two children (degree 3)

Hence using handshating lemma:

\(\frac{{\sum {d_i}}}{2}\; = \;\# edges\; = \;1\; + \;{i_1}\; + \;{i_2}\; + \;l - 1\;\)

2 + 2i1 + 3i2 + l = i1 + i2 + l

i2 = l – 2

∴ Total number of internal nodes with two children = l – 2

and total number of nodes with two children = l – 2 + 1 (root)

 = l – 1

CASE 2 : Root node with one child

∑di = 1 × 1 + 3i2 + 2i1 + l

\(\frac{{\sum {d_i}}}{2}\; = \;1\; + \;{i_1}\; + \;{i_2}\; + \;l\)

1 + 3i2 + 2i1 + l = 2 + 2i1 + 2i2 + 2l

i2 = l – 1

∴ Total number of nodes with two children = l – 1

Calculation:

l = 20

∴ i2 = I - 1 = 20 - 1 = 19

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...