Data Structures & AlgorithmsModerateGATE CS · TCS NQT

Problem: The path graph P4 has vertices 1–4 and edges 1-2, 2-3, 3-4. How many edges does its complement graph (on the same vertices, containing exactly the pairs not joined in P4) have?

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

Correct answer: C. 3

K4 has six edges, and P4 uses three of them, so its complement has three edges: 1-3, 1-4 and 2-4.

More Coding Interview Problems questions

Exams that ask this topic