The question is long, so I will paraphrase it brieflyQ: There are n people voting to choose the chair of the committee. Each person can vote for one person that has unique id (it is positive integer and vote will be stored in array). Chair will be the one with the most vote. Design algorithm to determine who is the chair and what would be the time complexity? Then if there are m < n candidates for the chair and we know value of m, what would be the algorithm to determine who is the chair and its time complexity?(Edit: okay so no boyer-moore algorithm)For the second part, I'm not sure why the fact that I know the value of m makes a difference. The last part of the question sounds like there are more efficient way of solving the problem when m is known.
Majority voting algorithm, there are n people and m candidates but m is known
algorithms;sorting
There is a trivial solution to the problem as you ask it:  create an array of counters for the candidates, and for each vote increment that candidate's counter; at the end of the voting, scan through the list and find the highest value.  O(n) time complexity under the assumption n >> m (which would be a prerequisite for making a voting system like this realistically feasible), or O(n + m) if you can't assume m is small.  O(m) storage.If your candidates ids are not sequentially allocated, the solution is a little harder, but you can simply use a hashtable to map the ids to their indices in the array.  This doesn't affect complexity as hashtables have O(1) [typical] lookup.The only reason you would realistically want anything other than this implementation is if you expect 'm' to be large, but that would be a very unusual situation.