GATE / CS ARCHIVE

GATE CSE 2003 / QUESTION 69

Room allocation from activity endpoints

Algorithms · Greedy Algorithms · Full GATE CSE 2003 paper

GATE 2003, Q69 2 marks · MCQ
Report issue

Greedy Algorithms

Question 69, GATE 2003: Activities A,...,H must each occupy a room throughout their duration. Let xs and xe denote the start and finish of X. The complete GateForum chronological sequence is:
as,bs,cs,ae,ds,ce,es,fs,be,de,gs,ee,fe,hs,ge,he.
GFG instead prints the same sequence with ce omitted. What is the minimum number of rooms?
A. 3  B. 4  C. 5  D. 6
The omission is a material source discrepancy; do not silently insert ce into the GFG version.
Tap to enlarge
Your answer
Answer & solution

Answer: None (no official key was published)

1. For the complete sequence, count a start as +1 and a finish as −1. The successive active counts are 1,2,3,2,3,2,3,4,3,2,3,2,1,2,1,0. The maximum is four, at fs with B,D,E,F simultaneously active.
2. Four rooms suffice constructively: assign room 1 to A,D,G; room 2 to B,H; room 3 to C,E; room 4 to F. Every reuse occurs after that room's previous finish.
4. Without ce, C may or may not still be running at fs, so the the paper sequence can require five rather than four. Preserve the baseline unanswered status for the defective primary version rather than guessing the missing event.

The maximum overlap is four, attained after F starts while B,D,E,F are active. The the paper omits C's finishing event. The incomplete the paper sequence cannot determine a unique answer without supplying the missing endpoint.

Original paper, page 10