Data Structures & AlgorithmsVery hardGATE CS · Codeforces Div2 C
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 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. 8
- 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: 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…
- A rooted tree has these parent→child edges: 48→30, 81→95, 48→81, 30→87, 87→14, 30→80, 48→65. A DFS starts at the root and visits the…
- A rooted tree has these parent→child edges: 68→18, 76→82, 76→34, 82→68, 70→39, 82→70, 34→29, 70→17. A DFS starts at the root and visits…