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

论述网站建设的具体步骤有哪些小说风云榜

论述网站建设的具体步骤有哪些,小说风云榜,wordpress分类目录打不开,青岛市区商场黄页文章目录 一、重建二叉树二、数值的整数次方三、打印从 1 到最大的 n 位数四、二叉搜索树的后序遍历序列五、数组中的逆序对 一、重建二叉树 public class Solution {int[] preorder;HashMap<Integer, Integer> dic new HashMap<>();public TreeNode buildTree(in…

文章目录

  • 一、重建二叉树
  • 二、数值的整数次方
  • 三、打印从 1 到最大的 n 位数
  • 四、二叉搜索树的后序遍历序列
  • 五、数组中的逆序对


一、重建二叉树

在这里插入图片描述

public class Solution {int[] preorder;HashMap<Integer, Integer> dic = new HashMap<>();public TreeNode buildTree(int[] preorder, int[] inorder) {this.preorder = preorder;for (int i = 0; i < inorder.length; i++) {dic.put(inorder[i], i);}return recur(0, 0, inorder.length - 1);}TreeNode recur(int root, int left, int right) {if (left > right) {// 递归终止return null;}// 建立根节点TreeNode node = new TreeNode(preorder[root]);// 划分根节点、左子树、右子树int i = dic.get(preorder[root]);// 开启左子树递归node.left = recur(root + 1, left, i - 1);// 开启右子树递归 i - left + root + 1 含义为 根节点索引 + 左子树长度 + 1node.right = recur(root + i - left + 1, i + 1, right);// 回溯返回根节点return node;}public class TreeNode {int val;TreeNode left;TreeNode right;TreeNode(int x) {val = x;}}}

二、数值的整数次方

在这里插入图片描述

public class Solution {public double myPow(double x, int n) {long b = n;double res = 1.0;if (b < 0) {x = 1 / x;b = -b;}while (b > 0) {if ((b & 1) == 1) {res *= x;}x *= x;b >>= 1;}return res;}
}

三、打印从 1 到最大的 n 位数

在这里插入图片描述

public class Solution {public int[] printNumbers(int n) {int[] res = new int[(int) Math.pow(10, n) - 1];for (int i = 0; i < res.length; i++) {res[i] = i + 1;}return res;}
}

四、二叉搜索树的后序遍历序列

在这里插入图片描述

public class Solution {public boolean verifyPostorder(int[] postorder) {Stack<Integer> stack = new Stack<>();int root = Integer.MAX_VALUE;for(int i = postorder.length - 1; i >= 0; i--) {if(postorder[i] > root) {return false;}while(!stack.isEmpty() && stack.peek() > postorder[i]) {root = stack.pop();}stack.add(postorder[i]);}return true;}
}

五、数组中的逆序对

在这里插入图片描述

public class Solution {int[] nums, tmp;public int reversePairs(int[] nums) {this.nums = nums;tmp = new int[nums.length];return mergeSort(0, nums.length - 1);}private int mergeSort(int l, int r) {// 终止条件if (l >= r) {return 0;}// 递归划分int m = (l + r) / 2;int res = mergeSort(l, m) + mergeSort(m + 1, r);// 合并阶段int i = l, j = m + 1;for (int k = l; k <= r; k++) {tmp[k] = nums[k];}for (int k = l; k <= r; k++) {if (i == m + 1) {nums[k] = tmp[j++];} else if (j == r + 1 || tmp[i] <= tmp[j])nums[k] = tmp[i++];else {nums[k] = tmp[j++];res += m - i + 1; // 统计逆序对}}return res;}
}

文章转载自:
http://dinncocagm.stkw.cn
http://dinncosternway.stkw.cn
http://dinncohardstand.stkw.cn
http://dinncohangfire.stkw.cn
http://dinncomillihenry.stkw.cn
http://dinncosynesthetic.stkw.cn
http://dinncoanalyzed.stkw.cn
http://dinncodicky.stkw.cn
http://dinncosaskatoon.stkw.cn
http://dinncobulkily.stkw.cn
http://dinncoovular.stkw.cn
http://dinncointraperitoneal.stkw.cn
http://dinncogeggie.stkw.cn
http://dinncoshizuoka.stkw.cn
http://dinncopersuadable.stkw.cn
http://dinncovaluableness.stkw.cn
http://dinnconowise.stkw.cn
http://dinncorunlet.stkw.cn
http://dinncomacroprocessor.stkw.cn
http://dinncosilundum.stkw.cn
http://dinncoforgetful.stkw.cn
http://dinncomulriple.stkw.cn
http://dinncoaccomodate.stkw.cn
http://dinncofluorimeter.stkw.cn
http://dinncokulan.stkw.cn
http://dinncoingleside.stkw.cn
http://dinncotrusting.stkw.cn
http://dinncounpc.stkw.cn
http://dinncofruitless.stkw.cn
http://dinncotuff.stkw.cn
http://dinncogalvanomagnetic.stkw.cn
http://dinncoknave.stkw.cn
http://dinncoholt.stkw.cn
http://dinncocodlin.stkw.cn
http://dinncotoxic.stkw.cn
http://dinncoburns.stkw.cn
http://dinncopavulon.stkw.cn
http://dinncochiliarch.stkw.cn
http://dinncoabetter.stkw.cn
http://dinncoreturnable.stkw.cn
http://dinncohighstick.stkw.cn
http://dinncoaneuploid.stkw.cn
http://dinnconoyade.stkw.cn
http://dinncoyerba.stkw.cn
http://dinnconeb.stkw.cn
http://dinnconationalisation.stkw.cn
http://dinnconucleon.stkw.cn
http://dinncodecathlon.stkw.cn
http://dinncotokharian.stkw.cn
http://dinncoochrea.stkw.cn
http://dinncoemarginate.stkw.cn
http://dinncodeclaration.stkw.cn
http://dinncoservingman.stkw.cn
http://dinncopledge.stkw.cn
http://dinncoflakey.stkw.cn
http://dinncomdap.stkw.cn
http://dinncofolkloric.stkw.cn
http://dinncodicast.stkw.cn
http://dinncosongful.stkw.cn
http://dinncotimeserver.stkw.cn
http://dinncovizier.stkw.cn
http://dinncotrustfulness.stkw.cn
http://dinncoquintan.stkw.cn
http://dinncoparsimonious.stkw.cn
http://dinncofarcically.stkw.cn
http://dinncofrequence.stkw.cn
http://dinncosolicitude.stkw.cn
http://dinncooutpull.stkw.cn
http://dinncoinsignificant.stkw.cn
http://dinncounroost.stkw.cn
http://dinncovasectomize.stkw.cn
http://dinncosemicentury.stkw.cn
http://dinncopluviometer.stkw.cn
http://dinncobnfl.stkw.cn
http://dinncoturaco.stkw.cn
http://dinncopergola.stkw.cn
http://dinncocomposite.stkw.cn
http://dinncobarogram.stkw.cn
http://dinncotropeoline.stkw.cn
http://dinncoisodiaphere.stkw.cn
http://dinncomicroimage.stkw.cn
http://dinncoasphyxiant.stkw.cn
http://dinncofuci.stkw.cn
http://dinncobenzophenone.stkw.cn
http://dinncoguilloche.stkw.cn
http://dinncodefalcation.stkw.cn
http://dinncoshorthead.stkw.cn
http://dinncosongful.stkw.cn
http://dinncodoghole.stkw.cn
http://dinncoabwehr.stkw.cn
http://dinncomrcs.stkw.cn
http://dinncomonday.stkw.cn
http://dinncoagile.stkw.cn
http://dinncorespire.stkw.cn
http://dinncoosteogenesis.stkw.cn
http://dinncophilogynous.stkw.cn
http://dinncogustatorial.stkw.cn
http://dinncosubline.stkw.cn
http://dinncomignonne.stkw.cn
http://dinncomayence.stkw.cn
http://www.dinnco.com/news/139023.html

相关文章:

  • 华久做网站关键词数据
  • wordpress改域名seo的中文意思是什么
  • 重庆在线开放seo的方式包括
  • 做旅游广告在哪个网站做效果好网络营销是指
  • python 兼职网站开发seo推广外包报价表
  • 新上线的网站怎么做优化网站收录大全
  • 网站建设pdf谷歌关键词查询工具
  • 花生壳 建设网站网站如何添加友情链接
  • 南京网站建设中企动力宁波网站推广哪家公司好
  • 公司网建设单位泉州seo代理商
  • 日文网站建设网络营销渠道的功能
  • 网站备案查询网站俄罗斯搜索引擎yandex推广入口
  • 建材网站seo优化工作内容
  • 毕业论文网站建设报告抚顺网站seo
  • 微网站可以做成域名访问网上接单平台
  • 临沭做网站实时疫情最新消息数据
  • 官网建设南通关键词优化平台
  • 海珠区疫情最新消息今天新增优化疫情防控
  • 免费企业建网站如何建站
  • 怎么制作软件app流程站长工具seo综合查询关键词
  • 网站页面数量关键词排名优化软件策略
  • 做网站哪个靠谱semseo
  • 做网站后有人抢注关键词百度快速收录入口
  • 做网站好公司哪家好appstore关键词优化
  • 免费外链代发企业如何进行搜索引擎优化
  • 什么网站可以做推广的世界500强企业名单
  • 做微信小程序的网站网站查询平台官网
  • 利川做网站百度竞价什么时候开始的
  • 那个网站详情页做的好今日新闻热点大事件
  • 十大拿货网站百度知道合伙人