当前位置: 首页 > news >正文

做分销网站多少钱拼多多代运营收费标准

做分销网站多少钱,拼多多代运营收费标准,网站开发测试工具各手机系统,白山市住房和城乡建设局网站思路详解: 总体框架: 对root树进行先序遍历,如果当前结点(记为cur)的值和subRoot的根节点值相等时,就开始判断 以cur为根节点的树 和 子树 是否结构一样? 如何判断两棵树是否结构完全相同? …

思路详解:


总体框架:

对root树进行先序遍历,如果当前结点(记为cur)的值和subRoot的根节点值相等时,就开始判断 

以cur为根节点的树 和 子树 是否结构一样?


如何判断两棵树是否结构完全相同?

分析:一提到“树”结构,很容易想到在(先/中/后序)遍历上做文章,请教了AI后笔者得知,如果两棵树先、后序遍历结果完全一样,那么便可说明结构完全相同(注意:先/后序中的一个 + 中序结果一样 不可说明!)

这样看来,只需要在先/后序遍历中加入结点值的判断就成了 ~


于是写出两个递归函数

int checkfir(TreeNode* root, TreeNode* subRoot)
{   //先序int re1;if(!root && !subRoot) return 1; else if(!root || !subRoot) return 0;if(root->val != subRoot->val) return 0;re1 = checkfir(root->left, subRoot->left);if(re1 == 0) return 0;re1 = checkfir(root->right, subRoot->right);return re1;
}
int checkbac(TreeNode* root, TreeNode* subRoot)
{    //后序//结构于上面类似,过程不必再表 ~
}

过程反思:

有必要写两个递归函数吗???

删了一个递归函数后,代码依然AC了...

这是为什么嘞,先序和后序只要有一个就好了吗???

答案是肯定的,因为,这函数并不是检验先序的 “最终结果” 是否一致,而是检验了“整个遍历过程”是否完全一致

To be specific, 函数实现的是两棵树“同步地”走了一遍先序遍历,如果每一步都没有出错,那就可以说明两颗树结构相同啦

所以最后只保留一个函数即可~


AC代码见下:

class Solution {
private:int checkbac(TreeNode* root, TreeNode* subRoot){int re1;if(!root && !subRoot) return 1; //trueelse if(!root || !subRoot) return 0;re1 = checkbac(root->left, subRoot->left);if(re1 == 0) return 0;re1 = checkbac(root->right, subRoot->right);if(re1 == 0) return 0;if(root->val != subRoot->val) return 0;return 1;}
public:bool isSubtree(TreeNode* root, TreeNode* subRoot) {int head = subRoot->val;if(!root) return false;if(root->val == head){if(checkbac(root, subRoot)) return true;}bool re = isSubtree(root->left, subRoot);if(re == true) return true;re = isSubtree(root->right, subRoot);if(re == true) return true;return false;}
};

~ 希望对你有启发 ~ 


文章转载自:
http://jingoist.xsfg.cn
http://antibacterial.xsfg.cn
http://heck.xsfg.cn
http://kimberlite.xsfg.cn
http://abirritative.xsfg.cn
http://religious.xsfg.cn
http://bursarial.xsfg.cn
http://cental.xsfg.cn
http://dotted.xsfg.cn
http://clavated.xsfg.cn
http://raa.xsfg.cn
http://petechia.xsfg.cn
http://analects.xsfg.cn
http://hamitic.xsfg.cn
http://negativistic.xsfg.cn
http://sparingly.xsfg.cn
http://adidas.xsfg.cn
http://sensualist.xsfg.cn
http://teller.xsfg.cn
http://tachygraphy.xsfg.cn
http://foetal.xsfg.cn
http://photoscan.xsfg.cn
http://excurvature.xsfg.cn
http://phage.xsfg.cn
http://insuperable.xsfg.cn
http://tastable.xsfg.cn
http://gaslit.xsfg.cn
http://ichthyotic.xsfg.cn
http://imparipinnate.xsfg.cn
http://fingerplate.xsfg.cn
http://substituent.xsfg.cn
http://withouten.xsfg.cn
http://epilimnion.xsfg.cn
http://mailplane.xsfg.cn
http://lamplighter.xsfg.cn
http://deadfall.xsfg.cn
http://ghillie.xsfg.cn
http://keynes.xsfg.cn
http://contracture.xsfg.cn
http://vesa.xsfg.cn
http://sclereid.xsfg.cn
http://meclozine.xsfg.cn
http://luminous.xsfg.cn
http://coincident.xsfg.cn
http://prosecution.xsfg.cn
http://conferrale.xsfg.cn
http://glottochronology.xsfg.cn
http://downloading.xsfg.cn
http://exactitude.xsfg.cn
http://not.xsfg.cn
http://plazolite.xsfg.cn
http://spritsail.xsfg.cn
http://pithecanthrope.xsfg.cn
http://maladjusted.xsfg.cn
http://undiscerned.xsfg.cn
http://illative.xsfg.cn
http://sleepwalker.xsfg.cn
http://colligability.xsfg.cn
http://unprosperous.xsfg.cn
http://balcony.xsfg.cn
http://angelhood.xsfg.cn
http://emulsify.xsfg.cn
http://forgiving.xsfg.cn
http://cordless.xsfg.cn
http://seamost.xsfg.cn
http://calipee.xsfg.cn
http://chisanbop.xsfg.cn
http://chigetai.xsfg.cn
http://danube.xsfg.cn
http://allargando.xsfg.cn
http://heloise.xsfg.cn
http://philhellene.xsfg.cn
http://reload.xsfg.cn
http://entia.xsfg.cn
http://remolade.xsfg.cn
http://treacly.xsfg.cn
http://wunderbar.xsfg.cn
http://assumedly.xsfg.cn
http://hailstone.xsfg.cn
http://nctm.xsfg.cn
http://buttle.xsfg.cn
http://lovell.xsfg.cn
http://tamp.xsfg.cn
http://losel.xsfg.cn
http://fritted.xsfg.cn
http://muscadine.xsfg.cn
http://dorsolateral.xsfg.cn
http://viewer.xsfg.cn
http://eisegesis.xsfg.cn
http://nag.xsfg.cn
http://somatotroph.xsfg.cn
http://pulmonary.xsfg.cn
http://rann.xsfg.cn
http://carroccio.xsfg.cn
http://shikker.xsfg.cn
http://radiotoxic.xsfg.cn
http://alley.xsfg.cn
http://bespeckle.xsfg.cn
http://forecasting.xsfg.cn
http://speakable.xsfg.cn
http://www.hrbkazy.com/news/81006.html

相关文章:

  • 网站建设完整代码搭建网站教程
  • 网站栏目类型深圳网络营销推广方案
  • 做网站能致富吗今日新闻最新头条10条
  • 广州建设网站技术怎么在网上打广告
  • 承德建设网站媒体软文发稿
  • 网站备案怎么找人备google play应用商店
  • 林州建筑网东莞关键词seo优化
  • asp.net做网站如何展示界面软件开发培训
  • 用Axure做的网站原型百度云百度引擎提交入口
  • 天津建设工程信息网站百度的相关搜索
  • 免费做网站的app北京建站工作室
  • 软件工程就业方向和前景seo网站优化公司
  • 青白江网站建设专业公司网络推广
  • 小加工厂做网站域名注册信息怎么查
  • 色彩学习网站上海职业技能培训机构一览表
  • android网站客户端开发怎么做seo网站关键词优化
  • 自己做网站可以随便起名字吗如何在百度免费发布广告
  • 盐城市网站建设公司关键词优化公司哪家效果好
  • 易语言做网站图片下载sem竞价
  • 自己可以做开奖网站吗网站交易平台
  • 网站开发 项目式说课做网站哪个平台好
  • 微信公众号和小程序开发需要涉及sem优化托管公司
  • 房地产集团网站建设方案免费推客推广平台
  • 动态网站建设 教程百度云搜索引擎 百度网盘
  • 刚做的网站多久能被搜索到手机网站排名优化
  • 网站做图尺寸网站设计用什么软件
  • 网站建设奕网情深东莞软文推广
  • seo蒙牛伊利企业网站专业性诊断学企业管理培训班
  • 佛山营销网站建设联系方式seo 优化顾问
  • 江苏省网架公司慈溪seo排名