Hacker News new | ask | show | jobs
by gone35 3711 days ago
I don't know JavaScript (maybe it somehow handles this automagically) but isn't his reverse function missing the base case of a NULL tree?

  function reverse(t) {
    var tmp = t.left;
    t.left  = reverse(t.right);
    t.right = reverse(tmp);
    return t;
  }
1 comments

yep - this would throw an exception. ...and it's missing other things too. ;-)