News for hackers. Stuff that matters.

quarktasche

Re:How to Pass a Programming Interview on Wednesday March 09, 2016 @04:40PM (#11255930)
Which part?

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.

Re:How to Pass a Programming Interview on Tuesday March 08, 2016 @03:03PM (#11248102)
Wouldn't the question about the moving average be a good one though? It should be quite obvious that you can calculate a moving average without remembering more than the current average and the window size. Given that, time and space complexity should be obvious. I think it would be a fine question to see if the interviewee has any idea what complexity means.

Or was it a more complicated moving average case (exponential etc) where the algorithm was given and you were asked to determine the complexity?

Re:Why C++ sucks (2016 edition) on Monday February 22, 2016 @05:46AM (#11149909)
I don't think the std::chrono example is fair at all.

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 > mirrorlist
Re:Predicting and controlling NetHack's randomness (2009) on Saturday October 03, 2015 @02:55PM (#10324950)
If you like this kind of thing go read this write-up of predicting hands in online poker due to bad implementations of shuffling and PRNG algorithms! Its quite a fun read.

https://www.cigital.com/papers/download/developer_gambling.p...

Might not work in some special cases though. Try:

  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().