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 <shubh2...@gmail.com> 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.