Cs50 Tideman Solution 90%

The classic solution uses a recursive function bool cycle(int end, int cycle_start) that tries to traverse from end to cycle_start following locked edges.

for (int i = 0; i < pair_count; i++)

if (strcmp(name, candidates[i]) == 0)

The Tideman algorithm works as follows:

// Update preferences for (int i = 0; i < num_voters; i++) for (int j = 0; j < num_candidates; j++) if (strcmp(voters[i].preferences[j], candidates[min_vote_index].name) == 0) for (int k = j; k < num_candidates - 1; k++) strcpy(voters[i].preferences[k], voters[i].preferences[k+1]); Cs50 Tideman Solution