The Dining Problem:
Several families go out to dinner together. In order to increase their social interaction, they would like to sit at tables so that no two members of the same family are at the same table. Assume that the dinner contingent has p
families and that the i
th family has a(i)
members. Also, assume there are q
tables available and that the j
th table has a seating capacity of b(j)
.
The question is: What is the maximum number of persons we can sit on the tables?
EDIT: This problem can be solved creating a Graph and running a maximum flow algorithm. But if we have 2*10^3 vertices with Dinic algorithm, the global complexity is O(10^6*10^6) = O(10^12).
If we only sit always the larger groups first, in a greedy manner. The complexity is O(10^6).
So my questions are:
1) Does the greedy approach in this problem work?
2) What is the best algorithm to solve this problem?