Random Pairings that don't Repeat

Posted by Andrew Robinson on Stack Overflow See other posts from Stack Overflow or by Andrew Robinson
Published on 2010-06-15T15:12:19Z Indexed on 2010/06/15 15:42 UTC
Read the original article Hit count: 333

Filed under:
|

This little project / problem came out of left field for me. Hoping someone can help me here. I have some rough ideas but I am sure (or at least I hope) a simple, fairly efficient solution exists.

Thanks in advance.... pseudo code is fine. I generally work in .NET / C# if that sheds any light on your solution.

Given:

A pool of n individuals that will be meeting on a regular basis. I need to form pairs that have not previously meet. The pool of individuals will slowly change over time. For the purposes of pairing, (A & B) and (B & A) constitute the same pair. The history of previous pairings is maintained. For the purpose of the problem, assume an even number of individuals. For each meeting (collection of pairs) and individual will only pair up once.

Is there an algorithm that will allow us to form these pairs? Ideally something better than just ordering the pairs in a random order, generating pairings and then checking against the history of previous pairings. In general, randomness within the pairing is ok.

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about data-structures