int minDepth(TreeNode *root) //二叉树最小深度
{
int l,r;
if(root==NULL) return 0;
if(root->left==NULL&&root->right==NULL)
{
return 1;
}
else if(root->left!=NULL&&root->right!=NULL)
{
l=minDepth(root->left);r=minDepth(root->right);
return l<r?l:r;
}
else return root->left!=NULL?minDepth(root->left):minDepth(root->right);
}