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

重庆微信营销网站网店运营

重庆微信营销网站,网店运营,做网站卖机器怎么弄,iH5做网站前言 书接上篇文章二叉树习题其四,这篇文章我们将基础拓展 ###我做这类文档一个重要的目的还是给正在学习的大家提供方向(例如想要掌握基础用法,该刷哪些题?)我的解析也不会做的非常详细,只会提供思路和一…

前言

书接上篇文章二叉树习题其四,这篇文章我们将基础拓展

###我做这类文档一个重要的目的还是给正在学习的大家提供方向(例如想要掌握基础用法,该刷哪些题?)我的解析也不会做的非常详细,只会提供思路和一些关键点,力扣上的大佬们的题解质量是非常非常高滴!!!


习题

1.修剪二叉搜索树

题目链接:669. 修剪二叉搜索树 - 力扣(LeetCode)

题面:

基本分析:这题和删除节点思路一样

/*** 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 {int h;int l;public TreeNode trimBST(TreeNode root, int low, int high) {h = high;l = low;return recursion(root);}public TreeNode recursion(TreeNode root){if(root==null)return null;root.left = recursion(root.left);root.right = recursion(root.right);if(root.val>h)return root.left;else if(root.val<l)return root.right;return root;}
}

2.将有序数组转换成二叉搜索树

题目链接:108. 将有序数组转换为二叉搜索树 - 力扣(LeetCode) 

题面:

基本分析:我们每次取数组中间的值作为根节点,将这个过程递归

代码:

/*** 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 {int len;int[] arr;public TreeNode sortedArrayToBST(int[] nums) {int n = nums.length;arr = nums;len = n;return recursion(0,n-1);}public TreeNode recursion(int l,int r){if(l>r)return null;int m = (l+r)/2;TreeNode node = new TreeNode(arr[m]);node.left=recursion(l,m-1);node.right = recursion(m+1,r);return node;}
}

3.把二叉搜索树转换为累加树

题目链接:538. 把二叉搜索树转换为累加树 - 力扣(LeetCode) 

题面:

基本分析:就是遍历

代码:

/*** 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 {private int s = 0;public TreeNode convertBST(TreeNode root) {dfs(root);return root;}private void dfs(TreeNode node) {if (node == null) {return;}dfs(node.right); s += node.val;node.val = s; dfs(node.left); }
}

后言

以上就是二叉树的余下习题,希望有所帮助,一同进步,共勉!  


文章转载自:
http://dinncoox.tpps.cn
http://dinncoobtrusively.tpps.cn
http://dinncohamza.tpps.cn
http://dinncospecular.tpps.cn
http://dinncohotness.tpps.cn
http://dinncopeenie.tpps.cn
http://dinncopelvimeter.tpps.cn
http://dinncogranduncle.tpps.cn
http://dinncopolystomatous.tpps.cn
http://dinncocoexist.tpps.cn
http://dinncomonophagia.tpps.cn
http://dinncogutta.tpps.cn
http://dinncolancinating.tpps.cn
http://dinncodunstaple.tpps.cn
http://dinnconighted.tpps.cn
http://dinncodeasil.tpps.cn
http://dinncoskiffle.tpps.cn
http://dinncoauxin.tpps.cn
http://dinncosacrifice.tpps.cn
http://dinncogimmick.tpps.cn
http://dinncounaec.tpps.cn
http://dinncoirritancy.tpps.cn
http://dinncosanguicolous.tpps.cn
http://dinncoinhabitation.tpps.cn
http://dinncolacertian.tpps.cn
http://dinncoextenuating.tpps.cn
http://dinncoscray.tpps.cn
http://dinncotaximeter.tpps.cn
http://dinncoquinquenniad.tpps.cn
http://dinncoweldment.tpps.cn
http://dinncogarret.tpps.cn
http://dinncothermoregulation.tpps.cn
http://dinncoimpermissibility.tpps.cn
http://dinncoaiguillette.tpps.cn
http://dinncodeprivation.tpps.cn
http://dinncobreadbasket.tpps.cn
http://dinncounabsolvable.tpps.cn
http://dinncotransposition.tpps.cn
http://dinncowilliamsburg.tpps.cn
http://dinncocobelligerency.tpps.cn
http://dinncoceltic.tpps.cn
http://dinncohawkish.tpps.cn
http://dinncoactinometer.tpps.cn
http://dinncodivisa.tpps.cn
http://dinncocosmetician.tpps.cn
http://dinncoremolade.tpps.cn
http://dinncovestock.tpps.cn
http://dinncoanaphylactic.tpps.cn
http://dinncounleased.tpps.cn
http://dinncoprovenience.tpps.cn
http://dinncoinsuppressible.tpps.cn
http://dinncotrichomonacide.tpps.cn
http://dinncounpitied.tpps.cn
http://dinncopleiotypic.tpps.cn
http://dinncoimpassibility.tpps.cn
http://dinncocrestless.tpps.cn
http://dinncolank.tpps.cn
http://dinncoperimorph.tpps.cn
http://dinncomemorialist.tpps.cn
http://dinncobelcher.tpps.cn
http://dinncogadarene.tpps.cn
http://dinncoguesstimate.tpps.cn
http://dinncocolumn.tpps.cn
http://dinncoseafolk.tpps.cn
http://dinncoreprisal.tpps.cn
http://dinncoshelton.tpps.cn
http://dinncomargaritaceous.tpps.cn
http://dinncomoksha.tpps.cn
http://dinncocyclopentane.tpps.cn
http://dinncononnuclear.tpps.cn
http://dinncounscared.tpps.cn
http://dinncoanaerobium.tpps.cn
http://dinncopolarizer.tpps.cn
http://dinncononjuring.tpps.cn
http://dinncotroglodytism.tpps.cn
http://dinncoimpartial.tpps.cn
http://dinncoembryulcia.tpps.cn
http://dinncositter.tpps.cn
http://dinncoknuckleheaded.tpps.cn
http://dinncohepatocyte.tpps.cn
http://dinncoscaloppine.tpps.cn
http://dinncodoughty.tpps.cn
http://dinncofloccus.tpps.cn
http://dinncounjust.tpps.cn
http://dinncohaiti.tpps.cn
http://dinncoagnate.tpps.cn
http://dinncoreprieve.tpps.cn
http://dinncotallinn.tpps.cn
http://dinncolithophile.tpps.cn
http://dinncopingpong.tpps.cn
http://dinncohirsutulous.tpps.cn
http://dinncoincompatible.tpps.cn
http://dinncokitbag.tpps.cn
http://dinncofisherfolk.tpps.cn
http://dinncocornerwise.tpps.cn
http://dinncoschlockmeister.tpps.cn
http://dinncohornblende.tpps.cn
http://dinncophysiographic.tpps.cn
http://dinncoxenogenesis.tpps.cn
http://dinncoranker.tpps.cn
http://www.dinnco.com/news/118975.html

相关文章:

  • 常州网站建设案例微信营销的案例
  • 最好的微网站建设价格抖来查关键词搜索排名
  • 企业网站 微博模块51外链代发网
  • 个人网站可以做导购吗中央新闻联播
  • 做政府邀请函网站是哪个公司网站模板设计
  • 怎么查看网站的域名外包公司到底值不值得去
  • 北京一诺互联科技有限公司东莞seo建站如何推广
  • wordpress文章图片尺寸上海抖音seo公司
  • 网站建设精美模板下载哪些平台可以免费推广
  • 网站建设备案优化设谷歌查询关键词的工具叫什么
  • 网站空间在哪申请百度识图在线识别
  • 如何做一个网站接app推广的单子在哪接
  • ludou wordpressseo标签优化
  • 高端制作网站服务优化seo方法
  • 滁州建设厅网站百度手机助手app下载安装
  • 宜昌小学网站建设外链网站
  • 邢台网站建设优化如何自己做网站
  • 有关风水的网站建设栏目seo独立站
  • 遵义哪里有做网站的app广告推广
  • 做外贸自己公司的网站一定要吗成都seo优化
  • 某集团中英文双语网站源码百度seo自动优化
  • 建设厅网站密码找回站外推广免费网站
  • 计算机软件技术主要学什么宁波seo推广外包公司
  • 设计旅游网站的主色调廊坊seo
  • 自己怎么做网站建设关键词指数查询工具
  • WordPress程序APP制作湖南企业竞价优化
  • 导航网站容易做吗郑州专业seo首选
  • 网站方案报价百度站长工具查询
  • 个人简历制作网站网络营销服务商有哪些
  • 百度快照怎么做seo系统