I need to make an efficient algorithm, for moving integers.
For e.g,,an avg of 100 items. So as the 100 numbers come, the average for 1..100 numbers.. as 101 number comes average of 2..101.. as 102 number comes average of 3..102..
I thought of one solution but i cant come up so that minimum numbers can be stored(as after wards, i have to do in microprocessor, but first, efficient in C/C++):
Step 1: store numbers from 1..100 and take average step 2: replace 1 by 101, and take average: 101,2,3...100 step 3: replace 2 by 102, and take average: 101,102,3,4...100
But it is not efficient, as i need to use less division operator also.
Can anyone help me out please.