An election is held in school to elect a president for the student council. There are five candidates, each one represented by a number from
1 – 5. Their names are stored in a corresponding array NAMES.
The students vote electronically and the numbers are entered into the collection VOTES. If any candidate gets more than 50% of the votes, that person is elected, otherwise there is a second vote between the two candidates with the highest number of votes.
Write an algorithm in pseudo code to do the following:
- read the values from the collection VOTES
- count the number of votes for each candidate
- output the result
- state the name of the winner or of the two candidates in the next round.
You should use the data structures given and may introduce any others that you think are useful for an efficient solution.