title: insertion in a binary tree
body: <p>How to perform insertion in a binary tree recursively such that it is always filled from the left hand side??? Following is the code that I've written which is of course erroneous...i am a bit weak in recursion...please provide your suggestions...  </p>
  
  <pre><code>void insert(node **root,int n)
  {
       node *temp;
       temp=(node *)malloc(sizeof(node));
       temp-&gt;data=n;
       temp-&gt;lchild=NULL;
       temp-&gt;rchild=NULL;
       if(*root==NULL)
       {
           *root=temp;
           return;
       }
       if((*root)-&gt;lchild==NULL)
       {
            (*root)-&gt;lchild=temp;
            return;
       }
       if((*root)-&gt;rchild==NULL)
       {
            (*root)-&gt;rchild=temp;
            return;
       }
       insert(&amp;((*root)-&gt;lchild),n);
       insert(&amp;((*root)-&gt;rchild),n);
       return;
  }
  </code></pre>