Data Structures & AlgorithmsHardGATE CS · Codeforces Div2 C
A tree has these parent→child edges: 57→44, 82→6, 57→5, 87→59, 10→37, 5→95, 95→39, 5→87, 37→57, 57→82. 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. 4
- B. 7
- C. 6
- D. 5
Correct answer: D. 5
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: 96→15, 71→48, 50→91, 50→90, 44→37, 50→71, 37→96, 91→44, 96→52, 52→31. A vertex cover is a set of…
- A tree has these parent→child edges: 30→54, 20→22, 92→86, 86→30, 27→64, 54→44, 30→32, 35→71, 92→35, 86→20, 67→92, 22→27, 71→13. A vertex…
- A tree has these parent→child edges: 1→17, 80→1, 34→80, 41→8, 84→18, 8→23, 49→84, 47→33, 1→47, 41→9, 34→49, 18→41. A vertex cover is a set…
- A tree has these parent→child edges: 39→55, 19→47, 19→22, 4→65, 65→89, 55→84, 65→86, 47→41, 70→4, 86→19, 47→39. A vertex cover is a set of…
- A tree has these parent→child edges: 78→70, 51→78, 8→11, 9→37, 37→34, 37→56, 51→9, 56→76, 11→86, 87→93, 70→8, 78→74, 56→87. A vertex cover…
- A tree has these parent→child edges: 72→38, 2→14, 2→86, 2→52, 19→72, 86→91, 38→68, 2→28, 56→2, 72→90, 86→70, 2→19. A vertex cover is a set…