Data Structures & AlgorithmsModerateGATE CS · Codeforces Div2 C
A tree has these parent→child edges: 10→85, 22→81, 85→22, 10→50, 50→42, 73→2, 81→73, 48→10. A vertex cover is a set of vertices such that every edge has at least one endpoint in the set. What is the size of a minimum vertex cover?
- A. 2
- B. 4
- C. 7
- D. 5
Correct answer: B. 4
In a tree the minimum vertex cover equals the maximum matching (König's theorem), found greedily from the leaves up. Counting leaves or internal nodes is a common misreading, not the optimum.
Practise more Trees, Graphs, Recursion and Dynamic Programming questionsTrees, Graphs, Recursion and Dynamic Programming: notes and key points
More Trees, Graphs, Recursion and Dynamic Programming questions
- A tree has these parent→child edges: 82→91, 74→48, 88→34, 74→56, 60→25, 51→60, 56→88, 91→74, 51→82. A vertex cover is a set of vertices…
- A tree has these parent→child edges: 17→24, 59→71, 50→98, 72→61, 39→59, 61→50, 59→17, 1→72, 39→1, 1→97. A vertex cover is a set of…
- A tree has these parent→child edges: 52→59, 36→42, 48→36, 48→45, 48→52, 55→48, 14→85, 36→22, 8→55, 45→14, 22→61. A vertex cover is a set…
- A tree has these parent→child edges: 16→40, 48→81, 81→79, 79→46, 48→16, 46→15, 76→47, 76→62, 40→76. A vertex cover is a set of vertices…
- A tree has these parent→child edges: 67→97, 32→77, 67→90, 94→38, 97→94, 77→8, 94→32, 67→79, 94→60, 32→72, 32→63. A vertex cover is a set…
- A tree has these parent→child edges: 56→17, 44→56, 25→90, 16→89, 91→16, 63→91, 17→25, 91→44, 91→40. A vertex cover is a set of vertices…