> If you want to import a day's worth of access logs into a hash map, you need to take into account not only the time but also the space complexity of this sort of solution.
Good thing space complexity is routinely discussed in these interviews.
And the idea that computation complexity only matters for 'the hot path' is way too dismissive.
For instance; a quadratic loop over a 10 million line log file is just a catastrophe (100 trillion iterations), even for something run once a day. Such a log file would happily fit into memory (it's mere gigabytes) and a hashmap would be perfectly adequete.
> Depending on how much traffic a service handles
Yes, it depends. The interviewee is expected to ask, or at least state what assumptions they're making.
Good thing space complexity is routinely discussed in these interviews.
And the idea that computation complexity only matters for 'the hot path' is way too dismissive.
For instance; a quadratic loop over a 10 million line log file is just a catastrophe (100 trillion iterations), even for something run once a day. Such a log file would happily fit into memory (it's mere gigabytes) and a hashmap would be perfectly adequete.
> Depending on how much traffic a service handles
Yes, it depends. The interviewee is expected to ask, or at least state what assumptions they're making.