quarktasche
Figuring out how to efficiently calculate a moving average seems like a good question for basic maths skills to me.
About complexity theory, there is already a lot of discussion about it's relevancy in the comments. My point was meant more along the line that, if you value a basic understanding of complexity theory, the question asked of the GP seems reasonable.
Or was it a more complicated moving average case (exponential etc) where the algorithm was given and you were asked to determine the complexity?
In the C++ case, you specify which clock you want. What kind of clock is DateTime.UtcNow()? Is it monotonic? What's the resolution? It's maybe in the documentation, but if the author refuses to remember simple syntax, surely he won't want to remember such details either.
The author also chose an example where he abuses the default behavior in the C# case. The last line in the C++ example just vanishes if you use the default behavior in both cases.
mv mirrorlist mirrorlist.bak
rankmirrors -n 10 mirrorlist.bak > mirrorlisthttps://www.cigital.com/papers/download/developer_gambling.p...
http://www.wolframalpha.com/input/?i=energy+to+heat+1l+of+wa...
def foo():
a = 4
def bar():
print("a = {a}".format(**locals()))
bar()
foo()
which will raise a KeyError, while it will work fine if you add a print(a)
to the end of bar().