New answers tagged

0 votes

Java - Select the maximum integers from sliding windows over an array

There may be avoidable overhead in finding the same key in a Map twice in a row, OTOH, an "industrial strength" Map implementation might cache the last ...
user avatar
  • 4,548
1 vote

Identify IRC users with largest vocabulary ignoring links and short words

Add comments. At the top of the file, explain what it does. Mention the expected input format and the output format. Include paths or "stdin and stdout". It's a quick script. Add enough that ...
user avatar
3 votes

Computing a simple moving average on an array in C++

Handling ends Handling the ends of the array where "lag" overhangs the data set one must make assumptions in regard to the missing data. You can zero missing data (same as ignoring it), you ...
user avatar
  • 20.2k
6 votes

Computing a simple moving average on an array in C++

Use const-references when you only read an argument std::vector <long double> SMA(std::vector <long double> &ARR, int lag) { A signature like this ...
user avatar
  • 18.8k
6 votes

Computing a simple moving average on an array in C++

Suggestion 1 std::vector <long double> SMA(std::vector <long double> &ARR, int lag) What is lag? I would rename ...
user avatar
  • 25.7k

Top 50 recent answers are included