News for hackers. Stuff that matters.

feliperibeiro

Re:Algorithms.js – Atwood's Law applied to CS101 on Friday May 30, 2014 @09:30AM (#7821624)
I've been doing this sporadically and in my free time, just for fun, so there are a lot of fundamental things that haven't been covered there. :)
Re:Algorithms.js – Atwood's Law applied to CS101 on Friday May 30, 2014 @09:29AM (#7821618)
You're right. This is the subtraction-based implementation, the division-based is the original and better one :)

https://github.com/felipernb/algorithms.js/commit/e5a04f9ad0...

Re:Algorithms.js – Atwood's Law applied to CS101 on Friday May 30, 2014 @09:13AM (#7821536)
Exactly! Also, many JS devs are clueless about CS101 basic things, it's a way to maybe make them a bit interested.

From the wiki (https://github.com/felipernb/algorithms.js/wiki):

  The intention is to blend academic concepts with the
  JavaScript bits of insanity, applying Atwood's Law to CS101.
Re:Algorithms.js – Atwood's Law applied to CS101 on Friday May 30, 2014 @09:07AM (#7821511)
Still this is an issue with the algorithm, not the implementation.

http://en.wikipedia.org/wiki/Euclidean_algorithm

Re:Algorithms.js – Atwood's Law applied to CS101 on Friday May 30, 2014 @08:34AM (#7821383)
This is the Euclidean algorithm for GCD, it's naive and simple. But if you see it more carefully, the commit that says "Optimized performance ..." contains just the lines:

  34      var tmp = a;
  35	  a = Math.max(a, b);
  36	  b = Math.min(tmp, b);
  37	  if (a % b === 0) return b;
to avoid the unnecessary repetitions if b is already the GCD
Re:Why we don't hire programmers based on puzzles and tricks on Friday February 22, 2013 @12:12PM (#5265281)
This is a complicated issue, but in my opinion the google/facebook style of interview is the one that gives you less false positives, even though it gives tons of false negatives. In other words, very few people who can do it are bad coders (false positives), but many good coders can't do it (false negatives).

So, as companies like Google and Facebook have so many applications, they're much more concerned about false positives than false negatives.