I don&#x27;t know JavaScript (maybe it somehow handles this automagically) but isn&#x27;t his reverse function missing the base case of a NULL tree?<p><pre><code>  function reverse(t) {
    var tmp = t.left;
    t.left  = reverse(t.right);
    t.right = reverse(tmp);
    return t;
  }</code></pre>