Interview Question
Country: United States
sort the n meeting according to their end times
Keep assigning the 1...n meetings to the first of the meeting room 1..m which is free
Who said you were given start times?
Can you prove your strategy works?
What does "works" mean in this question?
How does one define optimal for such a vague question?
meetings will have start and end times... This is the classic greedy problem - Inteval scheduling problem
u are just memorizing things , you have to state reasoning that is wat careercup is for
Lets assume somethings...m==1, n==2 and all meetings start at the same time, with varying end times. In this case, sorting by end times => the shortest meeting gets the room first. The proposed algorithm seems like one based on the "Shortest Job Next" algorithm. In this algo, the advantage is that the average wait times are minimized. If we assume meeting times and durations are known, this algorithm seems to work in my opinion.
Activity Selection Problem
- srdjan March 29, 2014Classic greedy algorithm....