3 ms·
Just to note, but if it's possible that your worst case is that all lines are unique, then you've effectively read the entire file into memory. But this just ge
by deathanatos 12y ago
Just to note, but if it's possible that your worst case is that all lines are unique, then you've effectively read the entire file into memory. But this just gets back to your point:
> rather than thinking about the data itself
…i.e, in this case, we need to realize that the set will require on the order of the size of how many unique items there are, and that in the worst case, that's O(n).
Of course, if you can guarantee that the size of unique set will fit into memory, then you're fine. But you might need a bit of knowledge about the data to do so.