Data Structures & AlgorithmsVery hardGATE CS · Codeforces Div2 C
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 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. 6
- C. 10
- D. 7
Correct answer: B. 6
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: 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…
- A tree has these parent→child edges: 59→18, 19→47, 16→98, 88→59, 47→91, 96→16, 3→13, 3→88, 98→7, 3→96, 18→92, 13→19. A vertex cover is a…
- A tree has these parent→child edges: 83→70, 86→49, 10→12, 10→67, 60→86, 86→10, 31→65, 10→76, 67→31, 65→7, 67→47, 70→60, 86→17. A vertex…