title: Level Order Traversal of a Binary Tree
body: <pre><code>void traverse(Node* root)
  {
      queue&lt;Node*&gt; q;
  
      Node* temp_node= root;
  
      while(temp_node)
      {
          cout&lt;&lt;temp_node-&gt;value&lt;&lt;endl;
  
          if(temp_node-&gt;left)
              q.push(temp_node-&gt;left);
  
          if(temp_node-&gt;right)
              q.push(temp_node-&gt;right);
  
          if(!q.empty())
          {
              temp_node = q.front();
              q.pop();
          }
          else
              temp_node = NULL;
     }
   }
  </code></pre>
  
  <p>The above posted code is my level order traversal code. This code works fine for me but One thing I dont like is I am explicitly initializing <code>temp_node = NULL</code> or I use break. But it does not seem to be a good code to me.</p>
  
  <p>Is there a neat implementation than this or how can I make this code better?</p>