Skip to content

baiyifan1999/Preferential-Voting-Simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Preferential-Voting-Simulation

This program implements a simulation of Australia’s preferential voting system using the instant-runoff voting algorithm. It reads candidate names and voter preference rankings from standard input, then processes the election through multiple elimination rounds until a winner is determined.

The program supports: • Reading and storing candidate names and voter preference rankings using arrays and strings • Counting first-preference votes and calculating vote percentages • Iteratively eliminating the candidate with the lowest votes and redistributing their ballots according to voter preferences • Applying deterministic tie-breaking rules based on input order • Displaying election results round-by-round • Sorting and presenting candidates in descending vote order using insertion sort

The implementation emphasizes structured programming, efficient data handling, and clear algorithm design, with a time complexity of approximately O(mn), where m is the number of candidates and n is the number of votes.

This project was developed in C for the University of Melbourne COMP10002 Foundations of Algorithms course, demonstrating practical use of arrays, strings, functions, and algorithmic problem solving.

About

This program implements a simulation of Australia’s preferential voting system using the instant-runoff voting algorithm. It reads candidate names and voter preference rankings from standard input, then processes the election through multiple elimination rounds until a winner is determined.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages