4), which will vary the value of k for many times.
I think to cover up this problem..
1. we can store the starting and ending numbers for every K in another
file (with file name of every set) and then sort the file names
according to the starting values for every K set,
2. hence creating an
I like Terry's idea.
Let's say the 5000 numbers are: {1,2,...,5000}
For every 200 numbers you choose, create a 5000 bit string .. which
corresponds to 625 bytes
which is infact less than the 800 bytes you would require to store the
200 numbers as ints.
You don't store the 200 numbers explicitly,
I get what Terry means now. But it still uses 625/800 = 78% of the
naive method in terms of diskspace (or memory, whatever), so I think
the save is not big enough (the job interview is RD targeted, which I
assume they want to hear one with large saving).
Prateek's idea is to reduce the time of
I didn't fully get what you mean, but sounds not memory efficient: if
we need to store the 200 integers per set, and don't forget they say it
could be a lot of sets (even have to write to disk because memory does
not fit).
I think a better alternative could be to choose EVEN 5000 numbers
(taking mod of 2 of any number out of these can help to check whether
it can be in the set or not) and then make out set of 200 from these
5000 even numbers..
the set of 200 nos can be written on the disk in a sorted manner so