This content has been marked as final. Show 3 replies
Dear everyone,A bit can only be 0 or 1. If you want to interpret the low order as the file number, you'll need to rethink it:
Suppose we have an array of millions of integers, we
wanna create 10 files:
0.txt (stores the integers in that array whose last
bit is 0.)
1.txt (stores the integers in that array whose last
bit is 1.)
2.txt (stores the integers in that array whose last
bit is 2.)
3.txt (stores the integers in that array whose last
bit is 3.)
0000 --> 0
0001 --> 1
0010 --> 2
0011 --> 3
1001 --> 9
1010 --> ?
1011 --> ?
So I am considering if we can OPEN all those files inYes, you can do that.
the beginning, and then look at each integer to
decide to which file to write to. Once all integers
have been gone through, CLOSE all files.
But I am not so sure if this will lead to more memoryThe files' contents are only loaded into memory if you explicitly do so by reading them. If you're just opening and writing, the files' contents will no be loaded into memory.
use, whether or not all the file content will be
loaded into RAM as the file is OPEN.
Also, can anybody give me some idea how I canWhat specific questions do you have? It's not clear what you're trying to do or what trouble you're having.
You might want to start here: