I am trying to implement a plurality voting algorithm where priorities are used to break ties. What I mean by priorities is the following. For example, we have three classes - A, B and C. But the priority goes A, C and B, starting with the highest - A to the lowest - B. So when A and C have equal votes and more than B, A will win the plurality vote because of its higher priority.
The only idea I have for the tie-breaking is to implement many if-statements. If I am not wrong, these are 10 for the case of 3 classes. But how can this be generalized so that I can implement an algorithm for K-classes? Can you please help with some code? It could be some imperative language like C, Java, JS, C#, Python, etc or pseudo-code.
Thank you very much!