If you're working on Linux then there's asynchronous I/O functions that do
well..
http://www.gnu.org/s/libc/manual/html_node/Asynchronous-I_002fO.html#Asynchronous-I_002fO

<http://www.gnu.org/s/libc/manual/html_node/Asynchronous-I_002fO.html#Asynchronous-I_002fO>Windows
might have similar functionality.



On Thu, Apr 21, 2011 at 6:41 AM, Gary Drocella <[email protected]> wrote:

> You could just use a pseudo-random number generator to fill in the
> array.
> You may also want to consider the data type (each unsigned int would
> be 4 bytes, where a unsigned char would be 1 byte).
> Or, If it's truly necessary to read this much data from the console...
> You could use unix pipes,  (cat file.out | ./myprog)
> pipes in unix shells will redirect from the standard i/o...
> The format of the file.out should be
> input0
> input1
> input2
> ...
> inputn
> where I guess in your case n = 10^6
> That should work, but I don't code in c++ (only c)
> On Apr 19, 10:11 pm, shubham <[email protected]> wrote:
> > Hello Geeks,
> > Suppose we have a 2-d array arr[1000][1000] capable of storing 10^6
> > elements in it. Input is supplied one row at a time. Then what is the
> > best possible way to read this much data in the least amount of time
> > as scanf() or cin takes a lot of time?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to