完全二叉树结点的数量
class Solution {
public:int countNodes(TreeNode* root) {if(root==NULL) return 0;TreeNode* le=root->left;TreeNode* ri=root->right;int ld=0;int rd=0;while(le){le=le->left;ld++;}while(ri){ri=ri->right;rd++;}if(ld==rd) return(2<<ld)-1;int ln=countNodes(root->left);int rn=countNodes(root->right);int result=ln+rn+1;return result;}
};