Hacker News new | past | comments | ask | show | jobs | submit login

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;
  }



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




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: