← Back to problems
Anduril • sensor fusion
Sensor Ring Buffer Mean
AeroSpace • fixed window • O(1) running mean
Fixed-size ring buffer of sensor samples. On each push(v), subtract the evicted value from a running sum, add the new sample, advance the write index — return mean in O(1) without rescanning the buffer.
PushO(1)
SpaceO(n)
Step0/0
Ready
Press Play or Step. Buffer size n = 4.