Calculating moving-averages of variable parameters
问题 I have an integer property which is updated every second with a signal-strength value ranging from 0 - 100. I'd like to be able to keep an ongoing measure of the moving average over the last 10, 25, 50 measurements. What's the most efficient way of doing this? I'm currently thinking of implementing a set of FIFO queues using NSMutableArray and popping the leading value every time I add a new one at the end once the array has the requisite number of entries. However, I'm not sure if there's a