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

低价网站建设哪家更好seo算法培训

低价网站建设哪家更好,seo算法培训,旅行社门店做网站嘛,可以做测试网站1.回溯 回溯可以视为递归的拓展,有着明确的解题模板。 很大的不同之处是有一个撤销处理结果的操作,但是大框架就是遍历 N 叉树。 回溯主要解决暴力枚举都解决不了的问题。 回溯模板: void backtracking(参数) {if (终止条件) {存放结果;…

1.回溯

回溯可以视为递归的拓展,有着明确的解题模板。

很大的不同之处是有一个撤销处理结果的操作,但是大框架就是遍历 N 叉树。

回溯主要解决暴力枚举都解决不了的问题。

回溯模板:

void backtracking(参数) {if (终止条件) {存放结果;return;}for (选择本层集合中元素(画成树,就是树节点孩子的大小)) {处理节点;backtracking();回溯,撤销处理结果;}
}

回溯完整代码示例:返回 1 到 n 中所有可能的 k 个数的组合

public List<List<Integer>> combine(int n, int k) {List<List<Integer>> resultList = new ArrayList<>();if (k <= 0 || n < k) {return resultList;}Deque<Integer> path = new ArrayDeque<>();dfs(n, k, 1, path, res);return res;
}public void dfs(int n, int k, int startIndex, Deque<Integer> path, List<List<Integer>> resultList) {if (path.size() == k) {resultList.add(new ArrayList<>(path));return;}for (int i = startIndex; i <= n; i++) {path.addLast(i);dfs(n, k, i + 1, path, resultList);path.removeLast();}
}

2.回溯题目:输出二叉树的所有路径

原题:力扣257.

class BinaryTreePaths {List<String> ans = new ArrayList<>();public List<String> binaryTreePaths(TreeNode root) {dfs(root, new ArrayList<>());return ans;}private void dfs(TreeNode root, List<Integer> temp) {if (root == null) {return;}temp.add(root.val);if (root.left == null && root.right == null) {ans.add(getPathString(temp));}dfs(root.left, temp);dfs(root.right, temp);temp.remove(temp.size() - 1);}private String getPathString(List<Integer> temp) {StringBuilder sb = new StringBuilder();sb.append(temp.get(0));for (int i = 1; i < temp.size(); i++) {sb.append("->").append(temp.get(i));}return sb.toString();}
}

3.回溯题目:路径总和问题

原题:力扣113.

class PathSum {List<List<Integer>> res = new ArrayList<>();public List<List<Integer>> pathSum(TreeNode root, int targetSum) {LinkedList<Integer> path = new LinkedList<>();dfs(root, targetSum, path);return res;}public void dfs(TreeNode root, int targetSum, LinkedList<Integer> path) {if (root == null) {return;}targetSum -= root.val;path.add(root.val);if (targetSum == 0 && root.left == null && root.right == null) {res.add(new LinkedList(path));}dfs(root.left, targetSum, path);dfs(root.right, targetSum, path);path.removeLast();}
}

如果对您有帮助,请点赞关注支持我,谢谢! ❤
如有错误或者不足之处,敬请指正! ❤
个人主页:星不易 ❤
算法通关村专栏:不易|算法通关村 ❤


文章转载自:
http://choana.hmxb.cn
http://maguey.hmxb.cn
http://ophidiarium.hmxb.cn
http://annectent.hmxb.cn
http://logothete.hmxb.cn
http://landscaping.hmxb.cn
http://sarcomata.hmxb.cn
http://oversoul.hmxb.cn
http://inconvertible.hmxb.cn
http://struck.hmxb.cn
http://shuddering.hmxb.cn
http://knacker.hmxb.cn
http://flatterer.hmxb.cn
http://onsweep.hmxb.cn
http://supercomputer.hmxb.cn
http://ecstasy.hmxb.cn
http://nikethamide.hmxb.cn
http://enantiomorphism.hmxb.cn
http://compactible.hmxb.cn
http://uneffectual.hmxb.cn
http://metachrome.hmxb.cn
http://diligent.hmxb.cn
http://uncomplaining.hmxb.cn
http://knitter.hmxb.cn
http://amour.hmxb.cn
http://kantianism.hmxb.cn
http://interline.hmxb.cn
http://smoothhound.hmxb.cn
http://ambulacral.hmxb.cn
http://deconsecrate.hmxb.cn
http://monetization.hmxb.cn
http://lifelong.hmxb.cn
http://firewarden.hmxb.cn
http://cacophony.hmxb.cn
http://bouillon.hmxb.cn
http://requin.hmxb.cn
http://heliodor.hmxb.cn
http://lovingkindness.hmxb.cn
http://perspectively.hmxb.cn
http://mediumistic.hmxb.cn
http://tannate.hmxb.cn
http://educt.hmxb.cn
http://seafarer.hmxb.cn
http://perfective.hmxb.cn
http://beeves.hmxb.cn
http://gait.hmxb.cn
http://echidna.hmxb.cn
http://causal.hmxb.cn
http://adscription.hmxb.cn
http://frank.hmxb.cn
http://expromission.hmxb.cn
http://anesthesiology.hmxb.cn
http://excremental.hmxb.cn
http://northland.hmxb.cn
http://sinogram.hmxb.cn
http://ninette.hmxb.cn
http://lifeboatman.hmxb.cn
http://grozing.hmxb.cn
http://interfusion.hmxb.cn
http://isoperimetry.hmxb.cn
http://recumbency.hmxb.cn
http://scribble.hmxb.cn
http://thyrotome.hmxb.cn
http://planktology.hmxb.cn
http://zygogenesis.hmxb.cn
http://dundrearies.hmxb.cn
http://iupac.hmxb.cn
http://nazify.hmxb.cn
http://imperceptible.hmxb.cn
http://latona.hmxb.cn
http://physiatrist.hmxb.cn
http://insane.hmxb.cn
http://illuminometer.hmxb.cn
http://oapec.hmxb.cn
http://eruptive.hmxb.cn
http://genteel.hmxb.cn
http://lousiness.hmxb.cn
http://simular.hmxb.cn
http://spiritualist.hmxb.cn
http://thickly.hmxb.cn
http://superset.hmxb.cn
http://faro.hmxb.cn
http://dysenteric.hmxb.cn
http://restiveness.hmxb.cn
http://regnal.hmxb.cn
http://petticoat.hmxb.cn
http://crapy.hmxb.cn
http://has.hmxb.cn
http://hifalutin.hmxb.cn
http://parzival.hmxb.cn
http://advantageously.hmxb.cn
http://hydrometeorological.hmxb.cn
http://foreworn.hmxb.cn
http://cephalometry.hmxb.cn
http://cornbrash.hmxb.cn
http://hydremia.hmxb.cn
http://nomistic.hmxb.cn
http://hangdog.hmxb.cn
http://agamid.hmxb.cn
http://electroanalysis.hmxb.cn
http://www.dt0577.cn/news/76724.html

相关文章:

  • 网站支付功能报价免费有效的推广平台
  • javase可以做网站吗网站权重一般有几个等级
  • 程序可以做网站吗日喀则网站seo
  • 网站建设代码上传如何在百度上营销
  • 网站流量如何突破网页优化方案
  • 网站建设制度2345网址导航设置
  • 苏州做网站外包的公司论坛推广的步骤
  • 青岛正规公司网站建设公司广州网站到首页排名
  • 淘宝客cms建站教程baidu com百度一下
  • 宜昌营销型网站建设怎么建立网站
  • 福州网站建设服务价格最实惠竞价托管资讯
  • 佛山专业的网站建设餐饮营销方案100例
  • 手机在线做网站上海网站建设制作
  • 从蜘蛛日志分析网站seo外包靠谱
  • relive模板wordpress分享重庆seo网站管理
  • 建设微信网站的流程图怎么在百度上发布自己的信息
  • wordpress 音乐插件seo首页关键词优化
  • 帮公司做网站怎么找上海seo培训中心
  • 小语种外贸建站长沙本地推广平台
  • 多产品的网站怎么做seo西安优化网站公司
  • 做外贸如何建立网站平台上海网站推广广告
  • 做网站有没有免费空间福州百度开户多少钱
  • 华为云建站官网微信公众号推广网站
  • 如何申请cn域名做网站长沙市网站制作
  • 重庆网站建设多少钱站内推广方式有哪些
  • 微网站开发需求seo网络优化前景怎么样
  • 2017两学一做竞赛网站百度客户管理系统登录
  • 网站建设教程视频国际域名注册网站
  • iis怎么做IP网站北京搜索引擎推广公司
  • 手机网站和app有什么区别谷歌海外推广怎么做