GATE Computer ScienceModerateGATE CS (PYQ pattern)

Twelve meetings occupy CLOSED time intervals [1,5], [2,6], [5,9], [6,7], [4,8], [7,11], [8,12], [3,10], [9,13], [10,14], [12,15], [13,16]; two meetings that merely touch at an endpoint still conflict. What is the minimum number of rooms needed?

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

Correct answer: D. 5

The minimum number of rooms equals the maximum number of intervals containing a common point. With closed intervals, at t = 5 the intervals [1,5], [2,6], [5,9], [4,8], [3,10] all contain 5, so 5 rooms are needed, and no point lies in 6 intervals. Treating the intervals as half-open (touching allowed) gives 4.

More Algorithms questions

Exams that ask this topic