标签:bool span color bsp style als res nbsp tree
bool helper(TreeNode *root1, TreeNode *root2) { if(root2==nullptr) return true; if(root1==nullptr) return false; if(root1->val==root2->val) { return helper(root1->left, root2->left)&&helper(root1->right, root2->right); } else { return false; } } bool HasSubtree(TreeNode* root1, TreeNode* root2) { bool result=false; if(root1!=nullptr && root2!=nullptr) { if(root1->val==root2->val) result=helper(root1, root2); if(!result) result=HasSubtree(root1->left, root2); if(!result) result=HasSubtree(root1->right, root2); } return result; }
标签:bool span color bsp style als res nbsp tree
原文地址:http://www.cnblogs.com/zhwcs/p/7575619.html