Question: (Algorithms) Suppose we are given an-element sequence S such that each element in S represents a different vote in an election, where each vote is
(Algorithms)Suppose we are given an-element sequence S such that each element in S represents a different vote in an election, where each vote is given as an integer representing the ID of the chosen candidate (these IDs come from the range 1. . . n5). Suppose you know the number k < n of candidates running. Describe aO(nlogk) worst-case algorithm for determining who wins the election. Argue that your running time is correct. Note that k could be much smaller thannand(nlogn) is only a partial solution.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
