Data Structures & AlgorithmsVery hardCodeforces Div 2 D · ICPC regional
An undirected graph has the vertices B, I, L, N, Q, Y, Z and the edges N–L, N–Y, N–Q, N–I, N–Z, L–Y, L–Q, B–I, B–Z. What is its chromatic number, the least number of colours needed to colour the vertices so that adjacent vertices differ?
- A. 2
- B. 4
- C. 3
- D. 6
Correct answer: C. 3
Searching colour counts from 1 upward finds 3 colours suffice and one fewer does not. Greedy colouring in label order uses 3, and the maximum degree bound gives 6; the clique number 3 is only a lower bound.
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
- An undirected graph has the vertices A, C, J, Q, S, Z and the edges S–C, S–J, S–A, Q–Z, C–J, A–Z. What is the size of a maximum matching…
- Floyd–Warshall runs on vertices 1 to 4 with these arcs u→v (weight): 1→2 (5), 1→4 (2), 2→1 (2), 2→3 (3), 2→4 (6), 3→1 (1), 3→4 (10), 4→2…
- A connected undirected graph has the vertices A, I, P, T, V, Y and the edges P–V, P–T, P–A, V–I, V–Y, I–A. Parallel edges are allowed when…
- On an 6×6 chessboard, rows and columns are numbered 0 to 5, and squares are written (row, column). A knight moves in the usual L-shape…
- An undirected graph has the vertices D, K, R, S, X, Y and the edges Y–R, S–X, D–S, Y–D, Y–S, R–K, R–X, D–R, R–S, D–X. What is the minimum…
- A connected undirected graph has the vertices E, H, O, P, V, W, X and weighted edges (weights in brackets): E–P (4), O–W (16), X–H (8)…