I am trying to calculate a windowed average where the newest value replaces the oldest value in a set of size 10. In this case, I have a real-time number stream and have access to current value, current average and the previous value.
Is there any way to calculate this value incrementally storing minimal amount of historical state? I have tried formulas in this question but they don't seem to be suitable for window situation