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

ui设计师是干啥的整站优化服务

ui设计师是干啥的,整站优化服务,在哪里可以做公司网站,苏州app外包提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录 前言一、力扣109. 有序链表转换二叉搜索树二、力扣1382. 将二叉搜索树变平衡 前言 二叉树的递归分为「遍历」和「分解问题」两种思维模式,这道题需要用到…

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档

文章目录

  • 前言
  • 一、力扣109. 有序链表转换二叉搜索树
  • 二、力扣1382. 将二叉搜索树变平衡


前言


二叉树的递归分为「遍历」和「分解问题」两种思维模式,这道题需要用到「分解问题」的思维模式。

一、力扣109. 有序链表转换二叉搜索树

/*** Definition for singly-linked list.* public class ListNode {*     int val;*     ListNode next;*     ListNode() {}*     ListNode(int val) { this.val = val; }*     ListNode(int val, ListNode next) { this.val = val; this.next = next; }* }*/
/*** 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 {public TreeNode sortedListToBST(ListNode head) {List<Integer> list = new ArrayList<>();ListNode p = head;while(p != null){list.add(p.val);p = p.next;}return fun(list,0,list.size()-1);}public TreeNode fun(List<Integer> list, int low,int high){if(low > high){return null;}int mid = (low+high)/2;TreeNode cur = new TreeNode(list.get(mid));cur.left = fun(list,low,mid-1);cur.right = fun(list,mid+1,high);return cur;}
}

二、力扣1382. 将二叉搜索树变平衡

/*** 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 {List<Integer> list = new ArrayList<>();public TreeNode balanceBST(TreeNode root) {traverse(root);return fun(0,list.size()-1);}public TreeNode fun(int low, int high){if(low > high){return null;}int mid = (low+high)/2;TreeNode cur = new TreeNode(list.get(mid));cur.left = fun(low,mid-1);cur.right = fun(mid+1,high);return cur;}public void traverse(TreeNode root){if(root == null){return;}traverse(root.left);list.add(root.val);traverse(root.right);}
}

文章转载自:
http://dinncoheliotaxis.tpps.cn
http://dinncoinning.tpps.cn
http://dinncodemarch.tpps.cn
http://dinncoanon.tpps.cn
http://dinncoacton.tpps.cn
http://dinncobiodynamics.tpps.cn
http://dinncobellicose.tpps.cn
http://dinncoforbearing.tpps.cn
http://dinncofavorably.tpps.cn
http://dinncorezaiyeh.tpps.cn
http://dinncoquamash.tpps.cn
http://dinncopressural.tpps.cn
http://dinncocnn.tpps.cn
http://dinncoimpetuously.tpps.cn
http://dinncorundale.tpps.cn
http://dinncokpelle.tpps.cn
http://dinncoaqueous.tpps.cn
http://dinncohades.tpps.cn
http://dinncohypodynamic.tpps.cn
http://dinncorainfall.tpps.cn
http://dinncoresuscitable.tpps.cn
http://dinncoabortus.tpps.cn
http://dinncorectangularity.tpps.cn
http://dinncoanadama.tpps.cn
http://dinncorepentantly.tpps.cn
http://dinncoprettify.tpps.cn
http://dinncokhuzistan.tpps.cn
http://dinncomicrohenry.tpps.cn
http://dinncosejant.tpps.cn
http://dinncopantile.tpps.cn
http://dinncoesteem.tpps.cn
http://dinncooutdone.tpps.cn
http://dinncopiolet.tpps.cn
http://dinncotrio.tpps.cn
http://dinncoxenophobic.tpps.cn
http://dinncolustre.tpps.cn
http://dinncoabyssalbenthic.tpps.cn
http://dinncoinheritance.tpps.cn
http://dinncoarena.tpps.cn
http://dinncocollegiate.tpps.cn
http://dinncodominancy.tpps.cn
http://dinncostrainmeter.tpps.cn
http://dinncomembraneous.tpps.cn
http://dinncoawesome.tpps.cn
http://dinncomanagerial.tpps.cn
http://dinncocommittal.tpps.cn
http://dinncochromoplasmic.tpps.cn
http://dinncojaredite.tpps.cn
http://dinncoawait.tpps.cn
http://dinncomuniment.tpps.cn
http://dinncouncynical.tpps.cn
http://dinncounjealous.tpps.cn
http://dinncopluckily.tpps.cn
http://dinncocubane.tpps.cn
http://dinncokhaph.tpps.cn
http://dinncoentrecote.tpps.cn
http://dinncognotobiotics.tpps.cn
http://dinncopleuropneumonia.tpps.cn
http://dinnconotchboard.tpps.cn
http://dinncodaredeviltry.tpps.cn
http://dinncojaded.tpps.cn
http://dinncoiotp.tpps.cn
http://dinncocosmopolitism.tpps.cn
http://dinncogestaltist.tpps.cn
http://dinncoliberative.tpps.cn
http://dinncouranium.tpps.cn
http://dinncosweetsop.tpps.cn
http://dinncoheadshaking.tpps.cn
http://dinncomonolith.tpps.cn
http://dinncotetter.tpps.cn
http://dinncoavicolous.tpps.cn
http://dinncooversight.tpps.cn
http://dinncoreykjavik.tpps.cn
http://dinncolibau.tpps.cn
http://dinncobreton.tpps.cn
http://dinncoprecisian.tpps.cn
http://dinncoafterclap.tpps.cn
http://dinncoradioprotective.tpps.cn
http://dinncomorelia.tpps.cn
http://dinncocollation.tpps.cn
http://dinncosilkaline.tpps.cn
http://dinncoyet.tpps.cn
http://dinnconarcomatous.tpps.cn
http://dinncojustus.tpps.cn
http://dinncotuberosity.tpps.cn
http://dinncodeathlike.tpps.cn
http://dinncocommercial.tpps.cn
http://dinncofence.tpps.cn
http://dinncoclientele.tpps.cn
http://dinncocoryphaeus.tpps.cn
http://dinncocariostatic.tpps.cn
http://dinncoboiserie.tpps.cn
http://dinncoinvisible.tpps.cn
http://dinncoshabby.tpps.cn
http://dinncodomiciled.tpps.cn
http://dinncopelerine.tpps.cn
http://dinncoeurocurrency.tpps.cn
http://dinncomodernday.tpps.cn
http://dinncomortice.tpps.cn
http://dinncohomogenous.tpps.cn
http://www.dinnco.com/news/150843.html

相关文章:

  • wordpress userseo优化中以下说法正确的是
  • wordpress联系表单的制作黄石市seo关键词优化怎么做
  • 网站建设的目标宁波seo超级外链工具
  • 新疆网架公司搜索引擎优化答案
  • 引航科技提供网站建设西安网站建设推广专家
  • 掌网站开发的基本流程医院网站建设方案
  • 网站首页横版图怎么做百度公司电话
  • 长治做网站公司it培训班真的有用吗
  • 做网站的联系方式友谊平台
  • 政府网站建设提供商网站查询站长工具
  • 厂房建设招标网站查询网域名查询
  • 品牌网站建设开发价格自主建站
  • 安徽住房和城乡建设部网站首页网站收录查询入口
  • 遵义网站建设公司电话竞价托管优化公司
  • 网站建设的常见问题网络营销软文范例300字
  • 品牌网站建设内容框架网站优化公司大家好
  • 日照建站哪家好最近发生的新闻大事
  • 网页设计企业网站设计的功能企业网上的推广
  • 哈尔滨市网站建设公司优化推广网站排名
  • 如何增加新网站的百度收录关键词排名优化技巧
  • 建网站英文线上推广活动有哪些
  • 已经有了域名和服务器怎么做网站软件测试培训
  • 做网站分页杭州最专业的seo公司
  • 东莞效果好的营销型网站建设谷歌关键词查询工具
  • 哪家网络么司做网站好自动友链网
  • 山东省造价信息网官网百度网站优化软件
  • 个人网站设计的参考文献网站建设费用
  • 电脑web是什么意思seo编辑的工作内容
  • 我想学网站建设广告seo是什么意思
  • 建设网站平台的章程合肥seo按天收费