Asked in a recent interview
There is a log file containing one million integers. Each integer is 32 bits in length. Specific integer values in the log file might be repeated. You can read the log file sequentially. You can also read from and write to temp files sequentially; there is no limit to the number of files that may be open at any time. However, you may keep no more than 2000 integers in memory at any given time.
I was asked to produce a histogram showing absolute counts for each integer value that occurs in the log file and state an upper bound on order complexity for the number of times that each integer must be loaded into memory