anonymous
  • anonymous
I have collected a huge pile of ballots for an election for class president. There are three candidates for the oce. Each ballot has a box for each candidate. The voter should write a 1 in the box for his top choice and a 2 for the second. A ballot is invalid if it does not follow that rule. The winner of the election is the candidate who gets a majority (more than 50%) of number-1 votes on valid ballots. If no candidate receives a majority, then the votes for the candidate in third place are given to the candidates who were marked 2 on the respective valid ballots. The candidate with the mos
MIT 6.00 Intro Computer Science (OCW)
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
schrodinger
  • schrodinger
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
now is the winner. If there is a tie at any point in the process, there is no winner. For example, suppose the candidates were Alice, Bob, and Chris. There are seven ballots: Alice: 1 Bob: Chris: 2 Alice: 2 Bob: 1 Chris: Alice: 3 Bob: 2 Chris: 1 Alice: 2 Bob: 1 Chris: Alice: 1 Bob: 2 Chris: Alice: Bob: 1 Chris: 2 Alice: Bob: 2 Chris: 1 The third ballot is invalid thanks to the unnecessary third-place vote for Alice, so it doesn't count. Otherwise, Alice has two rst-place votes, Bob has three, and Chris has one. While Bob has the most votes, he does not have a majority. The (valid) ballot marking Chris in rst place had Bob in second, so its vote goes to Bob. Now Alice has two votes, and Bob has four, so Bob wins. Write an algorithm (in English) to determine the winner (if any) of the election. Be as speci c as possible. In particular, each step of the algorithm can consider at most one ballot at a time. (So \count all the ballots" or \ nd the person with the most rst-place votes" is not a valid single step; you'll have to further break that down into other individual steps.)
anonymous
  • anonymous
THIS IS A ALGORITHM PROBLEM FOR ANOTHER PYTHON CLASS. PLEASE HELP.

Looking for something else?

Not the answer you are looking for? Search for more explanations.