Data Structures & AlgorithmsHardGATE CS · Codeforces Div 2 B

An undirected graph has the vertices A, J, Q, T, Y and the edges T–Q, T–A, Y–Q, Y–A, Q–A. What is its chromatic number, the least number of colours needed to colour the vertices so that adjacent vertices differ?

  1. A. 3
  2. B. 2
  3. C. 5
  4. D. 4

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 4; the clique number 3 is only a lower bound.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic