Allocating preferences
If n beds are to be allocated to m people.Each may have multiple 开发者_运维问答preferences or not prefer at all. How to satisfy maximum people. A person who had a preference and got the same will be accounted as a satisfied person.
I tried allocating a person with minimum preferences first with minimum preferred bed. Is there some case I am missing, because it gave me a wrong answer?
This is the maximum bipartite matching problem. Wiki has good algorithms, also look up maximum flow.
精彩评论