GATE IT 2008 · Arrays & Matrix Representation

MCQ · 2 marks · Problem PROG-DSTR-0183

A binary tree with n>1 nodes has \(n_{1}\), \(n_{2}\) and \(n_{3}\) nodes of degree one, two and three respectively. The degree of a node is defined as the number of its neighbors.Starting with the above tree, while there remains a node v of degree two in the tree, add an edge between the two neighbors of v and then remove v from the tree. How many edges will remain at the end of the process?
  1. A
    \(2 * n_{1}-3\)
  2. B
    \(n_{2}+2 * n_{1}-2\)
  3. C
    \(n_{3}-n_{2}\)
  4. D
    \(n_{2}+n_{1}-2\)

Solve it on GATE DA practice →More Basic Data Structures problems

Show the worked solutionOfficial GATE Answer Key: Option A.See full step-by-step discussion on GateOverflow: https://gateoverflow.in/3391/gate2008-it-77

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com