Home > database >  Algorithm design ideas
Algorithm design ideas

Time:10-03

The problem of []
300 sets of single dormitory, 300 sets of standard rooms (two men) dormitory (standard rooms can be used as a single room) , a team training, you need to arrange the dormitory to live for a period of time, now need to statistics a time (T1, T2) available in the dormitory, need to consider the time overlap problem, how to design the database with the algorithm is better?
[thinking] now
Database design: registration form (the team name, number of standard rooms, single rooms, start time, end time)
1, through statistics (T1, T2) period every day on the number of available room, behind the minimum value as the time segment can arrange room number
2, every day can stay in room will need to check to meet the start time & lt; The check time & lt; End time records, get the records available rooms, can get the check on the number of available dormitory date,
Can have a more efficient, simple and feasible scheme, for contact?

CodePudding user response:

Watch the article provides a train of thought, should feel and greedy algorithm on http://blog.csdn.net/ii1245712564/article/details/45313559
  • Related