bool isSametree(struct TreeNode*root1,struct TreeNode*root2)
{
if(root1==NULL&&root2==NULL)
return true;
if(root1==NULL||root2==NULL)
return false;
if(root1->val!=root2->val)
return false;
return isSametree(root1->left,root2->left)
&&isSametree(root1->right,root2->right);
}
bool isSubtree(struct TreeNode* root, struct TreeNode* subRoot){
if(root==NULL)
return false;
if(root->val==subRoot->val)
{if(isSametree(root,subRoot))
return true;}
return isSubtree(root->left,subRoot)
||isSubtree(root->right,subRoot);
}