I am programming in C++. There is a very long set of numbers (more than 8 billion elements). All the numbers are real (type double). I have to calculate, for example, the average of all of these elements. So many numbers do not fit in any array or a vector. How to solve the problem? Is it solvable?
I am guessing your numbers are into a file or accessible through a stream. Just do the computation little by little or by chunks by reading a 1024 elements at a time for example. I don't think you will need to keep them all into the heap.