Data Structures & AlgorithmsVery hardGATE CS · Codeforces Div2 C
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 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. 7
- B. 5
- C. 14
- D. 13
Correct answer: A. 7
In a tree, minimum vertex cover = maximum matching (König), found greedily from the leaves: take the parent of every uncovered leaf, giving 7. Counting the leaves gives 5, 14 is every vertex and 13 one vertex per edge.
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: 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…
- A rooted tree has these parent→child edges: 99→14, 99→52, 14→20, 14→16, 52→95, 99→53, 20→84. A DFS starts at the root and visits the…