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

找网站做任务领q币做设备出口网站

找网站做任务领q币,做设备出口网站,怎么做网站推广怀化,工信部做网站认证吗给定两个整数数组 inorder 和 postorder #xff0c;其中 inorder 是二叉树的中序遍历#xff0c; postorder 是同一棵树的后序遍历#xff0c;请你构造并返回这颗 二叉树 。 示例 1: 输入#xff1a;inorder [9,3,15,20,7], postorder [9,15,7,20,3] 输出#xff1a;[3…给定两个整数数组 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 3000postorder.length inorder.length-3000 inorder[i], postorder[i] 3000inorder 和 postorder 都由 不同 的值组成postorder 中每一个值都在 inorder 中inorder 保证是树的中序遍历postorder 保证是树的后序遍历 TreeNode *traversal(vectorint inorder, vectorint postorder) {//如果后子树为空则直接返回if (postorder.size() 0) return nullptr;//1.先确定后子树当中的根节点int rootValue postorder[postorder.size() - 1];//2,根据后结点取出来作为根结点的值TreeNode *root new TreeNode(rootValue);//3.如果它是叶子直接则直接返回if (postorder.size() 1) return root;//4.找切割点int delimiterIndex;for (delimiterIndex 0; delimiterIndex inorder.size(); delimiterIndex) {if (inorder[delimiterIndex] rootValue) break;}//切割中序数组得到 中序左数组和中序右数组vectorint leftInorder(inorder.begin(), inorder.begin() delimiterIndex);// [delimiterIndex 1, end)vectorint rightInorder(inorder.begin() delimiterIndex 1, inorder.end());//去除后子树中的最后一个结点postorder.resize(postorder.size() - 1);//切割后序数组得到 后序左数组和后序右数组vectorint leftPostorder(postorder.begin(), postorder.begin() leftInorder.size());// [delimiterIndex 1, end)vectorint rightPostorder(postorder.begin() leftInorder.size(), postorder.end());//最后组合数组并合root-left traversal(leftInorder, leftPostorder);root-right traversal(rightInorder, rightPostorder);return root;}TreeNode *buildTree(vectorint inorder, vectorint postorder) {if (inorder.size() 0 || postorder.size() 0) return NULL;return traversal(inorder, postorder);}
http://www.zqtcl.cn/news/826812/

相关文章:

  • 同ip网站有什么危害软文营销的特点有哪些
  • 用动易做的校园网站成品网站 免费试用
  • 没有网站做cpa怎么赚钱网站模板中企动力
  • 商会联盟网站建设方案免费的个人空间建网站
  • 徐州网站建设4个人网站设计师
  • 易企秀网站怎么做轮播图装饰设计公司wordpress主题
  • 网站建设搜索优wordpress the
  • 怎么做点图片连接网站北京大学网络服务
  • 家具制作网站台州网页设计公司
  • 优化网站 提高查询建设综合购物网站
  • 农产品网站设计方案湖南长沙网站建设公司
  • 网站过期查询服务器放网站吗
  • 郑州做网站的外包公司有哪些大连seo排名
  • 写小说的网站自己做封面2008年做的网站
  • 哈尔滨做网站哪家好强企业邮箱登录入口163
  • 网站点击率原因学php到做网站要多久
  • 哪里有创建网站的长沙网站seo技巧
  • 影楼公共网站wordpress提交360
  • 哪有做网站东莞中堂网站建设
  • 什么叫域名访问网站网络运营管理
  • 深圳网络推广网站泰安网站建设公司
  • 淄博网站建设铭盛信息如何注册一个app平台
  • 深圳网站的建设维护公司成功的网站必须具备的要素
  • wordpress主题站主题小型企业网站的设计与实现
  • 长沙专门做网站公司怎么进入网站管理页面
  • 做网站企业的发展前景东莞免费企业网站模板推广
  • 国外做锅炉的网站wordpress批量提交表单
  • 浙江省建设科技推广中心网站兼职做网站这样的网站
  • 网站开发前端培训最有设计感的网站
  • 巢湖有没有专门做网站的公司深圳 网站设计公司价格