Determining the final winners and all of its losers in a list of win/lose pairs
Posted on 2011-09-10
I'm having trouble figuring out the logic for the following problem - the application is a de-duping process that has to merge the contents of the duplicates:
I have a list of pairs of winners and losers
9962261 wins over 9962260
9962263 wins over 9962261
9962263 wins over 9962260
In this example, 9962263 is the winner, and wins out over 9962260 and 9962261.
imagine thousands of such contests expressed as records like this
how do i algorithmically end up with an array of the form
winner1, [list of losers]
winner2, [list of losers]
winner3, [list of losers]
such that there is no winner that is also a loser.
My logic fails me.