Question: Suppose you are a given a csv with N lines of the form StudentID, score. Multiple lines can have same student-ID. Find the student with maximum average score
I can't think of any way to make it faster than O(N*logN).
Maintain a hash-table that keeps track of STudentID = Key and Value being an object with sum of scores and number of scores seen with that studentID --> O(N)
Create an array with values in hash table, maybe convert each entry into average while doing so
Sort it worst-case N(logN), all entries belong to same student
Is there any way to do it faster?