English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Is there an efficient way to do this?

2006-09-25 17:51:31 · 1 answers · asked by specky_4554 l 1 in Computers & Internet Programming & Design

1 answers

There is an efficient way to do this. Assume you want a moving window of size M, sum up the first M numbers in that array and store this in a temporary variable. Next subbract out the first element and add in the M+1 th element. This is the running sum for the set of numbers from 2 to M+1. This is more efficient than trying to rerun the sum all over again.

2006-09-25 17:54:19 · answer #1 · answered by Answerer Ongoing 3 · 0 0

fedest.com, questions and answers