Interview Question
Country: India
It says long. So I presume you don't have enough memory in RAM for doing this... Care to elaborate?
It didn't say that there will be ALL long numbers in file. Need to be more clear about possible number of elements and amount of memory. Anyways,if bit array wouldn't fit into memory as well, we may use trie with string representation of those numbers, which I presume should take a lot less memory, since a lot of numbers would have long common prefixes.
a trie of numbers seems to be a better option than external sorting
- anonymous1 May 17, 2012