Question: Suppose we are given an S-element sequence S such that each element in S represents a different vote in an election, where each vote is
Suppose we are given an S-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. Without making any assumptions about who is running or even how many candidates there are, design an O(n log n) time algorithm to see who wins the election S represents, assuming the candidate with the most votes wins.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
