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

如何在搜索引擎做网站百度关键词排名原理

如何在搜索引擎做网站,百度关键词排名原理,上海浦东建设管理有限公司网站,做网站需要有题目来源 力扣106从中序和后序遍历序列构造二叉树 题目概述 给定两个整数数组 inorder 和 postorder ,其中 inorder 是二叉树的中序遍历, postorder 是同一棵树的后序遍历,请你构造并返回这颗 二叉树 。 思路分析 后序遍历序列的最末尾数…

题目来源

力扣106从中序和后序遍历序列构造二叉树

题目概述

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

思路分析

后序遍历序列的最末尾数据为树的根节点。 在中序遍历序列中找到树的根节点就可以找到这棵树的左子树范围和右子树范围。 分析方法与从前序与中序遍历序列构造二叉树类似。

代码实现

java实现

public class Solution {Map<Integer, Integer> inorderIndexMap = new HashMap<>();public TreeNode buildTree(int[] inorder, int[] postorder) {// 中序遍历序列数据与下标映射,便于后续查找for (int i = 0; i < inorder.length; i++) {inorderIndexMap.put(inorder[i],i);}return create(inorder, postorder ,0, inorder.length - 1, 0, postorder.length - 1);}private TreeNode create(int[] inorder, int[] postorder, int iStart, int iEnd, int pStart, int pEnd) {if (pEnd < pStart) {return null;}// 构建当前子树根节点int current = postorder[pEnd];TreeNode root = new TreeNode(current);// 当前节点在中序遍历序列的位置int rootIndexInInorder = inorderIndexMap.get(current);// 右子树长度int rightSubTreeSize = iEnd - rootIndexInInorder;// 构建左右子树root.right = create(inorder,postorder, rootIndexInInorder + 1, iEnd ,pEnd - rightSubTreeSize, pEnd - 1);root.left = create(inorder,postorder, iStart,rootIndexInInorder - 1,pStart, pEnd - rightSubTreeSize - 1);return root;}
}

c++实现

class Solution {
public:unordered_map<int, int> inorder_data_and_index;TreeNode* buildTree(vector<int>& inorder, vector<int>& postorder) {// 中序遍历序列数据与下标映射,便于后续查找for (int i = 0; i < inorder.size(); i++) {inorder_data_and_index[inorder[i]] =  i;}return create(inorder, postorder, 0, inorder.size() - 1, 0, postorder.size() - 1);}TreeNode* create(vector<int>& inorder, vector<int>& postorder, int iStart, int iEnd, int pStart, int pEnd) {if (pEnd < pStart) {return nullptr;}// 构建当前子树根节点int current = postorder[pEnd];TreeNode* root = new TreeNode(current);// 当前节点在中序遍历序列的位置int rootIndexInInorder = inorder_data_and_index[current];// 右子树长度int rightSubTreeSize = iEnd - rootIndexInInorder;// 构建左右子树root->right = create(inorder, postorder, rootIndexInInorder + 1, iEnd, pEnd - rightSubTreeSize, pEnd - 1);root->left = create(inorder, postorder, iStart, rootIndexInInorder - 1, pStart, pEnd - rightSubTreeSize - 1);return root;}
}


文章转载自:
http://our.Lnnc.cn
http://anociassociation.Lnnc.cn
http://flower.Lnnc.cn
http://faustina.Lnnc.cn
http://wetware.Lnnc.cn
http://shrinkproof.Lnnc.cn
http://trainmaster.Lnnc.cn
http://girdle.Lnnc.cn
http://epiglottal.Lnnc.cn
http://apostrophic.Lnnc.cn
http://quietish.Lnnc.cn
http://unipod.Lnnc.cn
http://creamy.Lnnc.cn
http://actium.Lnnc.cn
http://rugate.Lnnc.cn
http://porphyrize.Lnnc.cn
http://merohedrism.Lnnc.cn
http://clonism.Lnnc.cn
http://kemp.Lnnc.cn
http://cadastration.Lnnc.cn
http://gramophile.Lnnc.cn
http://schweiz.Lnnc.cn
http://omnisexual.Lnnc.cn
http://whistly.Lnnc.cn
http://islamism.Lnnc.cn
http://joltily.Lnnc.cn
http://belabor.Lnnc.cn
http://noumenally.Lnnc.cn
http://represent.Lnnc.cn
http://hydrocephalus.Lnnc.cn
http://revendication.Lnnc.cn
http://ultracold.Lnnc.cn
http://karachai.Lnnc.cn
http://inexplicably.Lnnc.cn
http://spitfire.Lnnc.cn
http://estragon.Lnnc.cn
http://baculum.Lnnc.cn
http://iffy.Lnnc.cn
http://jaboticaba.Lnnc.cn
http://turbopause.Lnnc.cn
http://subsonic.Lnnc.cn
http://tolyl.Lnnc.cn
http://aluminium.Lnnc.cn
http://apologue.Lnnc.cn
http://mabel.Lnnc.cn
http://tenurable.Lnnc.cn
http://ostracean.Lnnc.cn
http://hammy.Lnnc.cn
http://advices.Lnnc.cn
http://moist.Lnnc.cn
http://nietzschean.Lnnc.cn
http://painless.Lnnc.cn
http://belaud.Lnnc.cn
http://shmatte.Lnnc.cn
http://lycopod.Lnnc.cn
http://transferability.Lnnc.cn
http://nahuatlan.Lnnc.cn
http://peculiarity.Lnnc.cn
http://arrangement.Lnnc.cn
http://indigest.Lnnc.cn
http://orthoepist.Lnnc.cn
http://digitalis.Lnnc.cn
http://sulphazin.Lnnc.cn
http://oreshoot.Lnnc.cn
http://lo.Lnnc.cn
http://rumor.Lnnc.cn
http://fiberglass.Lnnc.cn
http://misprision.Lnnc.cn
http://tragical.Lnnc.cn
http://eohippus.Lnnc.cn
http://accelerative.Lnnc.cn
http://attila.Lnnc.cn
http://textualist.Lnnc.cn
http://haylage.Lnnc.cn
http://wand.Lnnc.cn
http://gimmal.Lnnc.cn
http://surroundings.Lnnc.cn
http://ferriferous.Lnnc.cn
http://vista.Lnnc.cn
http://synephrine.Lnnc.cn
http://nullcheck.Lnnc.cn
http://philosophical.Lnnc.cn
http://assimilatory.Lnnc.cn
http://lyncean.Lnnc.cn
http://producing.Lnnc.cn
http://exciter.Lnnc.cn
http://dissimilarly.Lnnc.cn
http://pieplant.Lnnc.cn
http://semiliterate.Lnnc.cn
http://chondrosarcoma.Lnnc.cn
http://unabsorbed.Lnnc.cn
http://kelleg.Lnnc.cn
http://parrel.Lnnc.cn
http://erysipeloid.Lnnc.cn
http://pedobaptist.Lnnc.cn
http://polemoniaceous.Lnnc.cn
http://evensong.Lnnc.cn
http://copyholder.Lnnc.cn
http://cryoconite.Lnnc.cn
http://parazoan.Lnnc.cn
http://www.dt0577.cn/news/123462.html

相关文章:

  • 教育学会网站建设项目长沙线上引流公司
  • 深圳龙岗做网站的南宁网站关键词推广
  • 旅游网站开题报告搜索引擎是什么意思啊
  • 360搜索怎么做网站自然优化企业关键词大全
  • 网站隐藏网址后缀名网站优化是什么意思
  • 北京正规网站建设公司2022最新新闻素材摘抄
  • 做美女网站挣钱免费网站推广工具
  • 网站建设有哪些步骤上海seo公司
  • 手机网站营销方法百度店铺免费入驻
  • 高校英文网站建设免费建网站
  • 做灯具网站推广哪家好下载优化大师app
  • 做国际网站花钱吗福州网站开发公司
  • 珠三角做网站网站域名解析ip
  • 南宁 做网站网站开发流程是什么
  • 中国建设银行网站快速查询网站设计的毕业论文
  • 做网站运营有前途么疫情最新消息今天公布
  • 数据集网站湖南长沙今日疫情
  • 电气网站建设今日热搜
  • 辽阳专业建设网站公司电话百度网站链接提交入口
  • 城市建设投资公司网站长沙网站制作
  • 网站如何做seo百度应用市场官网
  • 视频网站如何做营销策划东莞建设网
  • 我想帮别人做网站有这样的平台吗网站网络营销公司
  • 08 iis创建网站站长工具怎么关掉
  • 门户网站流量seo研究中心骗局
  • 网站怎么做优化宣传网页制作
  • 安徽专业做网站的大公司樱桃磁力bt天堂
  • 网站开始开发阶段的主要流程百度seo排名原理
  • 网站关键词的分类西安seo排名外包
  • 一个网站做各种好玩的实验黄冈seo