Sort:  

TimeOfVote and weight are arrays where the index, x, is the vote. SumOf means iterate over all values of x from 0 to the number of votes.