GATE | GATE-CS-2003 | Question 90

The following are the starting and ending times of activities A, B, C, D, E, F, G and H respectively in chronological order: “asbscsaedsceesfsbedegseefehsgehe

Here, xs denotes the starting time and xe denotes the ending time of activity X. W need to schedule the activities in a set of rooms available to us. An activity can be scheduled in a room only if the room is reserved for the activity for its entire duration. What is the minimum number of rooms required ?
(A) 3
(B) 4
(C) 5
(D) 6


Answer: (B)

Explanation: Room1 – As
Room2 – Bs
Room3 – As
now A ends (Ae) and now Room3 is free
Room3-Ds
now A ends (Ae) and Room1 is free
Room1-Es
Room4-Fs
now B ends Room2 is free
now D ends Room3 is free
Room2-Gs
now E ends Room1 free
now F ends Room4 free
Room1-Hs
now G and H ends.
Totally used 4 rooms

Source: https://www.gatementor.com/viewtopic.php?f=267&t=2195

Quiz of this Question



My Personal Notes arrow_drop_up


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.