Bifalgorithm post · Computer science one · Exercises
How does a Borda-count program process ranked election ballots?
How does a Borda-count program process ranked election ballots? (Computer science one · Exercises) — "Exercise 9.10. Ranked voting elections are elections wher…
Ideas in this flowchart
- Implement a Borda-count program for ranked voting elections.
- In a ranked voting election, each voter ranks every candidate instead of selecting only one.
- With n candidates, rankings range from 1 for best to n for worst.
- The program uses a Borda count as an alternative to a Condorcet method.
- A Condorcet method selects the candidate who wins every head-to-head majority contest.
- For a ranking r, the candidate receives n − r + 1 points.
- Candidates are ordered by total points, and the candidate with the highest total wins.
- The Borda system usually produces a consensus candidate rather than a majority-preferred candidate.
- The input file contains an ordered candidate list followed by ballot rankings.
- The first line lists candidate names separated by commas.
- Each later line contains comma-delimited rankings corresponding to the candidate order.
- The program reads and processes the election file.
- The input filename is supplied as a command-line argument, and the file is opened for processing.
- The program reports the election results.
- The results include each candidate's point total in candidate order and the overall winner.
- The results also include the total number of ballots.
- Every ballot may be assumed valid and complete, with all rankings provided.
- The example contains five ballots and identifies Bob as the winner.