title: Finding whether a binary search tree is perfect?
body: <p>I need to find if the binary tree is a perfect binary tree, meaning that each node has 2 nodes except for the last level. These are the methods I have so far but it doesn't seem to be working and I'm pretty much stuck on finding it. Any ideas?</p>
  
  <pre><code>private boolean isPerfect(BinaryNode&lt;AnyType&gt; t){
  
      int sizeTree = size(t);
  
      double num =  Math.log(sizeTree+1)/Math.log(2);  
  
      int checkNum = (int) (Math.floor(num));
  
      if(num - checkNum == 0)
          return true;
      else{
          return false;
      }
  }
  </code></pre>