title: How to check if all leaves are positioned to the left side of the BinaryTree
body: <p>i've been breaking my head on an tasks my lecturer posted as prep for the exams. The problem would be relative easy to solve if it weren't for his "own" take on the definition of a Perfect Binary Tree.</p>
  
  <p>My Task is this: "Check if any given BinaryTree is complete (complete = all but the last level needs to be full  <strong><em>AND</em></strong> on the last level all leaves need to be at the left side of the tree. Write a <strong><em>pointer</em></strong> implementation. So below tree is a Complete/Perfect tree in his definition. </p>
  
  <pre><code>       A
  
     B       C
  D     E  F   
  </code></pre>
  
  <p>Nearly all info on the internet on Perfect or Full trees don't tackle the specific requirement of " All leaves need to be on the left side".</p>
  
  <p>What i've done so far is write a class that get the total number of nodes in a given tree and compare it to the expected number based on the Perfect tree formula ( Math.pow(2, depth)-1)) </p>
  
  <p>Here is my code:</p>
  
  <pre><code>private int numberOfNodes =0;
  
  
  public void printLevelorder(){
      LinkedBlockingQueue&lt;BinaryNode&lt;E&gt;&gt; stack = new LinkedBlockingQueue&lt;BinaryNode&lt;E&gt;&gt;();
      BinaryNode&lt;E&gt; node = root;
      stack.offer(node);
      while( !stack.isEmpty()){
          node = stack.poll();
          if( node != null){
              if( node.getLeft() != null){
                  stack.offer(node.getLeft());
              }if( node.getRight() != null){
                  stack.offer(node.getRight());
              }
              numberOfNodes++;
              System.out.print(node.toString()+ " ");
          }
  
          else{
  
              return;
          }
  
  
      }
      System.out.println();
  }
  public int getMaxDepth(BinaryNode&lt;E&gt; node){
      int l =0, r =0;
      if( node != null){
          if( node.getLeft() != null){
              l = getMaxDepth(node.getLeft());
          }if( node.getRight() != null){
              r = getMaxDepth(node.getRight());
          }
      }
      return 1 + Math.max(l,r);
  }
  
  public boolean isComplete(){
      return isComplete(root);
  
  }
  
  private boolean isComplete(BinaryNode&lt;E&gt; node){
  
      int depth = this.getMaxDepth(node);
   int expectedNodes = (int)(Math.pow(2,depth)-1);
   System.out.println( numberOfNodes + "  -  " + expectedNodes);
  
  
  return false;
  }
  </code></pre>