Data Structures & AlgorithmsModerateCodeforces Div 2 D · ICPC regional
An undirected graph has the vertices B, C, F, L, O, P, Q, R, V, Z and the edges Q–L, Q–Z, Q–V, B–O, B–L, B–Z, B–R, B–P, O–Z, O–F, O–V, L–P, Z–F, Z–V, R–P, R–C, R–V, P–C, P–V, F–V. What is the size of a maximum independent set (a largest set of vertices with no edge between any two of them)?
- A. 5
- B. 6
- C. 4
- D. 3
Correct answer: C. 4
Exhaustive search over subsets gives 4. Picking the currently lowest-degree vertex and deleting its neighbourhood (a common heuristic) gives 3, and n minus the maximum matching gives 5, which is not a general identity.
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 grid has 6 rows and 4 columns (top to bottom; '.' open, '#' blocked): .... #... .... #... ..#. ..#. You may only move right or down, and…
- A bipartite graph has left side P1, P2, P3 and right side Q1, Q2, Q3, Q4, Q5, with edges P1–Q5, P1–Q3, P3–Q4, P1–Q2, P2–Q1, P2–Q4, P3–Q3…
- A directed graph has the vertices E, G, Q, Z and the arcs E→Q, E→Z, G→E, G→Q, G→Z, Q→G, Q→Z, Z→E. Count the directed Hamiltonian paths…
- A grid has 4 rows and 3 columns with these values (top to bottom): 121 725 748 239 A path moves between side-adjacent cells (up, down…
- A tree has vertices with weights in brackets: A[9], J[13], P[6], Q[8], M[2], V[3], Y[6], R[8]. The edges are A–J, J–P, A–Q, Q–M, P–V, Q–Y…
- A directed graph with no directed cycles has arcs u→v (weight) : I→X (0), I→C (8), I→T (7), X→C (2), C→T (-3), T→Z (0). Weights may be…