Algorithm ideas for this problem?

I have a series of values in chronological order. I need to calculate the mean of a specific percentile range (say, 60% to 80%), then remove the oldest value, add a new value and repeat.

The easiest way would be to just store them in a circular vector, copy and sort each iteration, then overwrite the oldest element. Though that's a tad expensive for large datasets..

It's not homework so anything from the standard library is usable

Thanks in advance

ETA: C++03 standard library
Last edited on
Topic archived. No new replies allowed.