News for hackers. Stuff that matters.
Re:White Elephant is surprisingly effective by akoboldfrying on Monday January 01, 2024 @02:59AM (#38830345)
The problem of finding the gift allocation with the highest sum of preferences is known as the Assignment Problem, a.k.a. finding a maximum-weight matching in a bipartite graph. Although brute force takes time proportional to the factorial of the number of players, this problem can be solved optimally in O(n^3) time using the Hungarian Algorithm: https://en.wikipedia.org/wiki/Hungarian_algorithm. This would mean you could optimally solve instances with a few hundred players.

There are no comments on this comment yet.