title: binary tree -print the elements according to the level
body: <p>This question was asked to me in an interview:</p>
  
  <p><img src="https://i.stack.imgur.com/GF2fy.png" alt="Binary tree"></p>
  
  <p>lets say we have above binary tree,how can i produce an output like below</p>
  
  <pre><code>2 7 5 2 6 9 5 11 4
  </code></pre>
  
  <p>i answered like may be we can have a level count variable and print all the elements sequentially by  checking the level count variable of each node.
  probably i was wrong.</p>
  
  <p>can anybody give anyidea as to how we can achieve that? </p>