Reputation: 207
I had a question about solving a weighted interval scheduling problem given a fixed number of classrooms. So, initially, we are given a set of intervals, each with a starting time and finishing time, and each with a weight. So, the aim of the problem is to find a scheduling in two classrooms that maximizes the weight. Is there an efficient way to do this by dynamic programming?
My approach was trivial, since I built an algorithm that simply maximizes the intervals for each classroom. Is there a better way to do this?
Upvotes: 0
Views: 329
Reputation: 1043
My idea is not fully dynamic programming. But I think it will help.
Please find the code here Time complexity of this code is O(nLog(n)).
Upvotes: 1