I've a vector made with struct that has a string and an int. The data is like this:
John 100
Jacob 90
Blake 99
Andy 105
John 65
Blake 70
Jacob 75
I've to print the name with the highest aggregate score. In this case, the added up scores will be like this
Blake 169
Jacob 165
John 165
Andy 105
So I've to print Blake 169. Once the scores are aggregated, the sorting isn't much of a problem, but how do I get the aggregation done first? So much like MapReduce. A simple code will be ideal as this is part of a program that is already a bit slow. Thanks.
Aucun commentaire:
Enregistrer un commentaire