1.递归处理,叶子节点的个数为1;
然后还有O(2)=O(0)-1;
度为2的节点比度为0的节点少一个
int BinaryTreeCount(TreeNode* root){
int nodes=0;
if(root==NULL)
return 0;
else if(root->left==NULL &&root->right=NULL)
return 1;
else
nodes=BinaryTreeCount(root->left)+BinartTreeCount(root->right);
return nodes;
}