Java判断满二叉树

判断满二叉树
public class Node{
    int value;
    Node left;
    Node right;
}
int deep(Node root){
    if(root==null){
        return 0;
    }
    int leftDepth = deep(root.left);
    int rightDepth = deep(root.right);
    return rightDepth>leftDepth?rightDepth+1:leftDepth+1;
}
bool isFullBinTree(Node root){
      if(root==null){
         return false;
      }
      if(root.left==null&&root.right==null){
          return true;
      }
     int leftDepth = deep(root.left);
     int rightDepth = deep(root.right);
     if(leftDepth!=rightDepth){
        return false;
     }
    if(isFullBinTree(root.left)&&isFullBinTree(root.right)){
       return true;
    }else{
       return false;
    }
    
             
}
原文地址:https://www.cnblogs.com/shijianchuzhenzhi/p/12984187.html