Reputation: 35
I am currently looking to implement an algorithm, that matches a given set of individuals, and produces groups of three individuals who have all never seen each other. So far I have been trying to achieve this by creating an array and assigning each individual a prime number (the id), which gets multiplied with another individuals id to create a key upon matching. This will then be used in successive matches to eliminate the possibility of matching again. So far the groups have been formed by simply taking a list of individuals, starting from the first and then matching that indiviual with the first individuals in the list, whose id does not divide the key, and then removes that group. However this has sometimes led to groups of people being left over, so i wanted to ask whether there is an existing algorithm for this problem already?
Upvotes: 1
Views: 150