Currently it iterates trough the list off all candidates. It would be better to have a variable that is a pointer to the leading candidate. This pointer would get checked after every vote cast to see if there is a new leader and update the pointer if so.
Currently it iterates trough the list off all candidates. It would be better to have a variable that is a pointer to the leading candidate. This pointer would get checked after every vote cast to see if there is a new leader and update the pointer if so.