I wrote c++ code to calculate 119 quantiles (from 10^-7 to 1 - 10^-7) of 100 millions of double precision numbers. My current implementation stores the numbers in a vector and then it sorts the vector. Is there any way to calculate the quantiles without storing the numbers?
Thank you
ADDENDUM (sorry for my English): Here is what I'm doing:
1) generate 20 uniformly distributed random numbers in [0, 1)
2) I feed those numbers into an algorithm that outputs a random number with unknown mean and unknown variance
3) store the number at step 2
repeat 1, 2 and 3 100 millions of times (now I collected 10^8 random numbers with unknown mean and unknown variance).
Now I sort those numbers to calculate 119 quantiles from 10^-7 to 1 - 10^-7 using the formula "R-2, SAS-5": https://en.wikipedia.org/wiki/Quantile#Estimating_quantiles_from_a_sample
Since the program is multi-threaded, the memory allocation is too big and I can only use 5 threads instead of 8.