Data Structures & AlgorithmsVery hardGATE CS · Codeforces Div2 C
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 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. 6
- B. 8
- C. 7
- 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 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…
- A rooted tree has these parent→child edges: 62→97, 33→7, 33→17, 62→10, 10→88, 10→35, 62→33, 88→2, 7→16. A DFS starts at the root and…
- A rooted tree has these parent→child edges: 75→17, 34→75, 75→45, 56→43, 43→14, 69→56, 43→34, 34→36. A DFS starts at the root and visits…
- A rooted tree has these parent→child edges: 30→84, 43→48, 28→43, 30→95, 28→22, 30→9, 87→89, 9→28, 37→65, 37→87, 37→30. A DFS starts at the…