An algorithm is needed to determine the winning candidate of an election based on a sequence of votes represented as integers, where each integer is the ID of a chosen candidate, without knowing how many candidates there are. The algorithm should run in O(n log n) time by sorting the sequence of votes and counting the number of votes for each candidate. The candidate with the most votes wins.