title: how to recursively visit all tree node
body: <p>So, I got a tree like this</p>
  
  <pre><code>                        a
                         /  \
                        b     c
                       / \   /
                      d   e  f
  </code></pre>
  
  <p>the function have to print:</p>
  
  <pre><code>a
  ab
  abd
  abe
  ac
  acf
  </code></pre>
  
  <p>my teacher say that the only argument that I can have is a pointer to the first node. I can't use any other variable including static and global variable.</p>
  
  <pre><code>void print(Node* a)
  {
    if(a==NULL){return;}
    cout&lt;&lt;a-&gt;data;
    if(a-&gt;left!=NULL){print(a-&gt;left);}
    if(a-&gt;right!=NULL){print(a-right);}
  }
  </code></pre>
  
  <p>So far, my program can only print "abdecf". any suggestion?</p>