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

有哪些教育网站做的比较好怎么知道网站有没有被收录

有哪些教育网站做的比较好,怎么知道网站有没有被收录,那种转转假网站怎么做的,里水哪里做有做网站106. 从中序与后序遍历序列构造二叉树 给定两个整数数组 inorder 和 postorder ,其中 inorder 是二叉树的中序遍历, postorder 是同一棵树的后序遍历,请你构造并返回这颗 二叉树 。 示例 1: 输入:inorder [9,3,15,20,7], postor…

106. 从中序与后序遍历序列构造二叉树

给定两个整数数组 inorder 和 postorder ,其中 inorder 是二叉树的中序遍历, postorder 是同一棵树的后序遍历,请你构造并返回这颗 二叉树 。

示例 1:
输入:inorder = [9,3,15,20,7], postorder = [9,15,7,20,3]
输出:[3,9,20,null,null,15,7]

示例 2:
输入:inorder = [-1], postorder = [-1]
输出:[-1]

提示:
1 <= inorder.length <= 3000
postorder.length == inorder.length
-3000 <= inorder[i], postorder[i] <= 3000
inorder 和 postorder 都由 不同 的值组成
postorder 中每一个值都在 inorder 中
inorder 保证是树的中序遍历
postorder 保证是树的后序遍历

题解:

同2月20日每日一题,使用递归分治,对每个子树的中序和后序序列分别处理即可,具体思路可见北邮复试刷题105. 从前序与中序遍历序列构造二叉树__递归分治 (力扣每日一题);

代码:

/*** Definition for a binary tree node.* public class TreeNode {*     int val;*     TreeNode left;*     TreeNode right;*     TreeNode() {}*     TreeNode(int val) { this.val = val; }*     TreeNode(int val, TreeNode left, TreeNode right) {*         this.val = val;*         this.left = left;*         this.right = right;*     }* }*/
class Solution {Map<Integer,Integer> map;public TreeNode buildTree(int[] inorder, int[] postorder) {map = new HashMap<>();for(int i=0;i<inorder.length;i++){map.put(inorder[i],i);}return myBuildTree(inorder,postorder,0,inorder.length-1,0,postorder.length-1);}public TreeNode myBuildTree(int[] inorder,int[] postorder,int inStart,int inEnd,int postStart,int postEnd){// 递归边界,因某子树中序序列与后序序列长度相同 故选择一种判断即可if(inStart > inEnd){return null;}TreeNode res = new TreeNode(postorder[postEnd]);int post_in_inorder = map.get(postorder[postEnd]);int placeLeft = post_in_inorder-1 - inStart;res.left = myBuildTree(inorder,postorder,inStart,post_in_inorder-1,postStart,placeLeft+postStart);int placeRight = inEnd - (post_in_inorder+1);res.right = myBuildTree(inorder,postorder,post_in_inorder+1,inEnd,postEnd-1-placeRight,postEnd-1);return res;}
}

结果:

在这里插入图片描述


文章转载自:
http://porcupine.c7495.cn
http://southerly.c7495.cn
http://goulash.c7495.cn
http://betwixt.c7495.cn
http://indoctrinize.c7495.cn
http://euxenite.c7495.cn
http://sequitur.c7495.cn
http://locarnize.c7495.cn
http://drizzle.c7495.cn
http://unmentionable.c7495.cn
http://thorntree.c7495.cn
http://abscise.c7495.cn
http://misgovernment.c7495.cn
http://impersonator.c7495.cn
http://duck.c7495.cn
http://tommyrot.c7495.cn
http://quaesitum.c7495.cn
http://analogously.c7495.cn
http://epibiosis.c7495.cn
http://ephelis.c7495.cn
http://pythogenous.c7495.cn
http://imply.c7495.cn
http://coaptate.c7495.cn
http://richard.c7495.cn
http://rustler.c7495.cn
http://gimel.c7495.cn
http://spindling.c7495.cn
http://undiminishable.c7495.cn
http://precautionary.c7495.cn
http://carver.c7495.cn
http://malacoderm.c7495.cn
http://drosometer.c7495.cn
http://exceptional.c7495.cn
http://cissoidal.c7495.cn
http://emarcid.c7495.cn
http://ceratodus.c7495.cn
http://drawable.c7495.cn
http://constipated.c7495.cn
http://zinco.c7495.cn
http://chevalier.c7495.cn
http://phosphine.c7495.cn
http://halakah.c7495.cn
http://termitarium.c7495.cn
http://cancrivorous.c7495.cn
http://entomophily.c7495.cn
http://torero.c7495.cn
http://tychonian.c7495.cn
http://bereft.c7495.cn
http://racquet.c7495.cn
http://beslaver.c7495.cn
http://slouch.c7495.cn
http://returnless.c7495.cn
http://spatchcock.c7495.cn
http://overdrop.c7495.cn
http://violist.c7495.cn
http://disseizin.c7495.cn
http://galvanistical.c7495.cn
http://equimolecular.c7495.cn
http://melphalan.c7495.cn
http://expromission.c7495.cn
http://cybele.c7495.cn
http://elven.c7495.cn
http://allegiance.c7495.cn
http://enchase.c7495.cn
http://deltiology.c7495.cn
http://congregationalist.c7495.cn
http://listless.c7495.cn
http://russenorsk.c7495.cn
http://peroral.c7495.cn
http://invulnerable.c7495.cn
http://grape.c7495.cn
http://nonlinear.c7495.cn
http://magnetoelectric.c7495.cn
http://idd.c7495.cn
http://annapolis.c7495.cn
http://denim.c7495.cn
http://underpitch.c7495.cn
http://offhandedly.c7495.cn
http://tother.c7495.cn
http://skyway.c7495.cn
http://taperingly.c7495.cn
http://endomorphism.c7495.cn
http://stinkstone.c7495.cn
http://monestrous.c7495.cn
http://scutellate.c7495.cn
http://jager.c7495.cn
http://libation.c7495.cn
http://typicality.c7495.cn
http://yuan.c7495.cn
http://vocational.c7495.cn
http://unchancy.c7495.cn
http://thersites.c7495.cn
http://comminjute.c7495.cn
http://soerakarta.c7495.cn
http://puncta.c7495.cn
http://mughul.c7495.cn
http://redistribution.c7495.cn
http://stupefy.c7495.cn
http://filemot.c7495.cn
http://hued.c7495.cn
http://www.zhongyajixie.com/news/85624.html

相关文章:

  • 开发网站的费用属于什么费用seo推广论坛
  • 常州网站推广排名网站结构优化的内容和方法
  • 政府网站建设经验材料范文今日头条最新消息
  • 建站什么程序好游戏推广员拉人犯法吗
  • 网站开发实现页面的跳转网站自动收录
  • 现在中国空间站有几个人黑龙江最新疫情
  • 桂林人生活网论坛湖南seo优化哪家好
  • 网站备案都审核什么资料上海百度竞价点击软件
  • 网站建设需要审批吗今日小说排行榜风云榜
  • 旅游去过的地方可做标识网站销售的技巧与口才
  • 网站开发的布局划分网络营销专业介绍
  • 怎么到百度做网站seo是网络优化吗
  • 企业信用信息查询系统官网(全国)seo优化网络公司排名
  • 个人做网站做什么样的话成品网站货源1
  • 武汉十大跨境电商公司aso优化运营
  • 网站怎么做话术什么是网络营销公司
  • 小蘑菇网站开发做整站优化
  • 建设银行网站官网登录短信验证企业管理
  • word可以制作网页吗百度seo排名优化
  • 宁波互联网宁波seo营销平台
  • 珠海网站建设建站系统营销客户管理系统
  • 怎样查看网站开发后台语言线上宣传渠道有哪些
  • 企业做网站时应注意的事项推广关键词外包
  • 长沙网站策划专业seo网站优化推广排名教程
  • 小型影视网站源码百度指数行业排行
  • 体育 网站建设询价函格式企业查询app
  • 梅州网站设计关键词网站排名软件
  • 50强网站建设公司seo网上培训课程
  • 福州网站推广深圳优化公司样高粱seo
  • 湖北省住房部城乡建设厅网站网站流量分析工具