O(N) being the worst-case, because you can bin-search the location of the customer ID in O(logN) and use it as a starting point for the iteration. If a single customer is responsible for all the page visits in a day (edge case and would probably indicate a problem in collecting the data), then the algorithm would revert back to an O(N) runtime.