Data Structures & AlgorithmsHardGATE CS · ICPC regional
An undirected graph has the vertices C, D, F, K, W, Y and the edges D–W, D–F, D–Y, D–K, W–Y, C–Y, C–K, F–Y, Y–K. What is its chromatic number, the least number of colours needed to colour the vertices so that adjacent vertices differ?
- A. 3
- B. 4
- C. 6
- D. 2
Correct answer: A. 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
- A flow network has source S and sink T, with directed arcs and capacities in brackets: S→D (9), S→B (6), D→B (9), D→T (4), E→D (3), E→T…
- A flow network has source S and sink T, with directed arcs and capacities in brackets: S→B (7), S→T (6), A→B (5), A→T (3), E→B (2), B→C…
- Starting from the integer 3, one operation either adds 1, subtracts 1, or doubles the current value. Values may be any non-negative…
- A pile holds p stones. In one move a player removes exactly s stones, where s is one of {4, 5, 6} and s ≤ the pile size. The player who…
- A pile holds p stones. In one move a player removes exactly s stones, where s is one of {2, 3, 5} and s ≤ the pile size. The player who…
- A directed acyclic graph has the vertices A, E, F, J, S, U and the arcs A→E, A→S, A→F, E→J, E→S, E→F, E→U, J→U, F→U. Two players…