return false;
if (is_source)
. As you iterate through each voter's ranked ballot, you update this matrix for every possible pair. 2. Create the pairs Next, we identify every pair of candidates where one candidate beat the other (i.e., preferences[i][j] > preferences[j][i] ). Each pair is stored in a struct containing: : The candidate with more votes. : The candidate with fewer votes. : The strength of the victory ( 3. Sort the pairs Cs50 Tideman Solution
The hardest part is lock_pairs() — locking a pair if it doesn’t create a cycle. return false; if (is_source)