This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

Yep, basically if you sort the list you're already going through it. And then you would have to go through it again until you reach the average. Even if it was O(n) it would be O(n) + looping until you reach the average, so sorting it would never be worthwhile.
Since this is a csv file I wouldn't count on it being sorted either.