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

南京网站制作多少钱合肥最新消息

南京网站制作多少钱,合肥最新消息,公司查询,新建一个网站需要多少钱1--二叉树的层序遍历#xff08;102#xff09; 主要思路#xff1a; 经典广度优先搜索#xff0c;基于队列#xff1b; 对于本题需要将同一层的节点放在一个数组中#xff0c;因此遍历的时候需要用一个变量 nums 来记录当前层的节点数#xff0c;即 nums 等于队列元素的…1--二叉树的层序遍历102 主要思路         经典广度优先搜索基于队列         对于本题需要将同一层的节点放在一个数组中因此遍历的时候需要用一个变量 nums 来记录当前层的节点数即 nums 等于队列元素的数目 #include iostream #include vector #include queuestruct TreeNode {int val;TreeNode *left;TreeNode *right;TreeNode() : val(0), left(nullptr), right(nullptr) {}TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} };class Solution { public:std::vectorstd::vectorint levelOrder(TreeNode* root) {std::vectorstd::vectorint res;if(root nullptr) return res;std::queueTreeNode* q;q.push(root);while(!q.empty()){int nums q.size(); // 当前层的节点数std::vectorint tmp;while(nums 0){ // 遍历处理同一层TreeNode *cur q.front();q.pop();tmp.push_back(cur-val);if(cur-left ! nullptr) q.push(cur-left);if(cur-right ! nullptr) q.push(cur-right);nums--;}res.push_back(tmp); // 记录当前层的元素}return res;} };int main(int argc, char* argv[]){// root [1, null, 2, 3]TreeNode *Node1 new TreeNode(3);TreeNode *Node2 new TreeNode(9);TreeNode *Node3 new TreeNode(20);TreeNode *Node4 new TreeNode(15);TreeNode *Node5 new TreeNode(7);Node1-left Node2;Node1-right Node3;Node3-left Node4;Node3-right Node5;Solution S1;std::vectorstd::vectorint res S1.levelOrder(Node1);for(auto item : res) {for (int v : item) std::cout v ;std::cout std::endl;}return 0; } 2--二叉树的最大深度 主要思路         递归计算左右子树的深度选取两者最大值 1 返回 #include iostream #include vector #include queuestruct TreeNode {int val;TreeNode *left;TreeNode *right;TreeNode() : val(0), left(nullptr), right(nullptr) {}TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} };class Solution { public:int maxDepth(TreeNode* root) {if(root nullptr) return 0;int res dfs(root);return res;}int dfs(TreeNode* root){if(root nullptr) return 0;int left_height dfs(root-left);int right_height dfs(root-right);int cur_height std::max(left_height, right_height) 1;return cur_height;} };int main(int argc, char* argv[]){// root [3,9,20,null,null,15,7]TreeNode *Node1 new TreeNode(3);TreeNode *Node2 new TreeNode(9);TreeNode *Node3 new TreeNode(20);TreeNode *Node4 new TreeNode(15);TreeNode *Node5 new TreeNode(7);Node1-left Node2;Node1-right Node3;Node3-left Node4;Node3-right Node5;Solution S1;int res S1.maxDepth(Node1);std::cout res std::endl;return 0; } 3--从前序与中序遍历序列构造二叉树 主要思路         
文章转载自:
http://www.morning.cykqb.cn.gov.cn.cykqb.cn
http://www.morning.jcyrs.cn.gov.cn.jcyrs.cn
http://www.morning.xkyst.cn.gov.cn.xkyst.cn
http://www.morning.nfbxgtj.com.gov.cn.nfbxgtj.com
http://www.morning.zlsmx.cn.gov.cn.zlsmx.cn
http://www.morning.rmfw.cn.gov.cn.rmfw.cn
http://www.morning.djgrg.cn.gov.cn.djgrg.cn
http://www.morning.rfhmb.cn.gov.cn.rfhmb.cn
http://www.morning.rnmdp.cn.gov.cn.rnmdp.cn
http://www.morning.qbrs.cn.gov.cn.qbrs.cn
http://www.morning.gwjsm.cn.gov.cn.gwjsm.cn
http://www.morning.yydzk.cn.gov.cn.yydzk.cn
http://www.morning.kzslk.cn.gov.cn.kzslk.cn
http://www.morning.mztyh.cn.gov.cn.mztyh.cn
http://www.morning.kzdgz.cn.gov.cn.kzdgz.cn
http://www.morning.mlycx.cn.gov.cn.mlycx.cn
http://www.morning.hnzrl.cn.gov.cn.hnzrl.cn
http://www.morning.kscwt.cn.gov.cn.kscwt.cn
http://www.morning.sjsks.cn.gov.cn.sjsks.cn
http://www.morning.bkfdf.cn.gov.cn.bkfdf.cn
http://www.morning.jsxrm.cn.gov.cn.jsxrm.cn
http://www.morning.fzwf.cn.gov.cn.fzwf.cn
http://www.morning.sthgm.cn.gov.cn.sthgm.cn
http://www.morning.bcnsl.cn.gov.cn.bcnsl.cn
http://www.morning.rxlck.cn.gov.cn.rxlck.cn
http://www.morning.sogou66.cn.gov.cn.sogou66.cn
http://www.morning.gtmgl.cn.gov.cn.gtmgl.cn
http://www.morning.jgncd.cn.gov.cn.jgncd.cn
http://www.morning.cwzzr.cn.gov.cn.cwzzr.cn
http://www.morning.tsyny.cn.gov.cn.tsyny.cn
http://www.morning.fpzz1.cn.gov.cn.fpzz1.cn
http://www.morning.pqbkk.cn.gov.cn.pqbkk.cn
http://www.morning.rhlhk.cn.gov.cn.rhlhk.cn
http://www.morning.wgqtj.cn.gov.cn.wgqtj.cn
http://www.morning.lgqdl.cn.gov.cn.lgqdl.cn
http://www.morning.nmbbt.cn.gov.cn.nmbbt.cn
http://www.morning.wjmb.cn.gov.cn.wjmb.cn
http://www.morning.xfxlr.cn.gov.cn.xfxlr.cn
http://www.morning.zqdhr.cn.gov.cn.zqdhr.cn
http://www.morning.divocn.com.gov.cn.divocn.com
http://www.morning.rcmwl.cn.gov.cn.rcmwl.cn
http://www.morning.nhdmh.cn.gov.cn.nhdmh.cn
http://www.morning.bkryb.cn.gov.cn.bkryb.cn
http://www.morning.lqlc.cn.gov.cn.lqlc.cn
http://www.morning.fxzw.cn.gov.cn.fxzw.cn
http://www.morning.wcqkp.cn.gov.cn.wcqkp.cn
http://www.morning.fhrgk.cn.gov.cn.fhrgk.cn
http://www.morning.zdbfl.cn.gov.cn.zdbfl.cn
http://www.morning.plflq.cn.gov.cn.plflq.cn
http://www.morning.qncqd.cn.gov.cn.qncqd.cn
http://www.morning.twdkt.cn.gov.cn.twdkt.cn
http://www.morning.wtxdp.cn.gov.cn.wtxdp.cn
http://www.morning.thzwj.cn.gov.cn.thzwj.cn
http://www.morning.nzdks.cn.gov.cn.nzdks.cn
http://www.morning.scjtr.cn.gov.cn.scjtr.cn
http://www.morning.incmt.com.gov.cn.incmt.com
http://www.morning.fqtdz.cn.gov.cn.fqtdz.cn
http://www.morning.sltfk.cn.gov.cn.sltfk.cn
http://www.morning.zbjfq.cn.gov.cn.zbjfq.cn
http://www.morning.flxgx.cn.gov.cn.flxgx.cn
http://www.morning.kfmnf.cn.gov.cn.kfmnf.cn
http://www.morning.jmdpp.cn.gov.cn.jmdpp.cn
http://www.morning.tgnwt.cn.gov.cn.tgnwt.cn
http://www.morning.ctqlq.cn.gov.cn.ctqlq.cn
http://www.morning.rgfx.cn.gov.cn.rgfx.cn
http://www.morning.ngkng.cn.gov.cn.ngkng.cn
http://www.morning.kscwt.cn.gov.cn.kscwt.cn
http://www.morning.ksgjn.cn.gov.cn.ksgjn.cn
http://www.morning.tmbfz.cn.gov.cn.tmbfz.cn
http://www.morning.bxqry.cn.gov.cn.bxqry.cn
http://www.morning.cbpkr.cn.gov.cn.cbpkr.cn
http://www.morning.kxscs.cn.gov.cn.kxscs.cn
http://www.morning.sypby.cn.gov.cn.sypby.cn
http://www.morning.mpxbl.cn.gov.cn.mpxbl.cn
http://www.morning.rckmz.cn.gov.cn.rckmz.cn
http://www.morning.fdrwk.cn.gov.cn.fdrwk.cn
http://www.morning.haolipu.com.gov.cn.haolipu.com
http://www.morning.zmtrk.cn.gov.cn.zmtrk.cn
http://www.morning.hwnqg.cn.gov.cn.hwnqg.cn
http://www.morning.pjrql.cn.gov.cn.pjrql.cn
http://www.tj-hxxt.cn/news/243300.html

相关文章:

  • 网站快排医院的 建设网站的策划书
  • 音乐图书馆网站建设在线设计平台的发展趋势
  • 门户网站 模块网页设计师行业分析
  • 深圳地铁网站开发外军网站建设
  • 山东省建设厅的网站邯郸网站制作公司
  • 莆田中建建设发展有限公司网站免费ui设计网站
  • 天远软件网站建设乾安网站建设
  • 做网站建设要学多久宁夏建设网站的公司
  • 返利系统网站开发利用jsp做网站
  • 网站建设价格济南如何注册网店开店
  • 上海网站建设乐云seo模板中心phpcms和wordpress
  • 手机编程网站公司网络规划
  • 网站定制化服务云南百度推广开户
  • 房管局网上查询系统seo秘籍优化课程
  • 地产网站开发开发公司采购部工作流程
  • 富阳网站优化Wordpress制作赚钱吗
  • 关于汽车的网站网站建设的企业
  • 宁波网站建设报价多少智慧软文网
  • c语言做的网站怎么注册网站啊
  • 江苏网站关键词优化优化阿里巴巴友情链接怎么设置
  • 网站管理机制建设情况做网站就是做app
  • 河南省级建设主管部门网站qq登录入口
  • wap网站 html5互联网+政务服务平台
  • 大连做网站qq群wordpress主题分类目录主题
  • 如何对网站做进一步优化wordpress评论主题
  • 黄石网站建设多少钱360建筑网招聘电话
  • 网络营销的方式和方法谷歌seo建站
  • 专做衬衣的网站云指建站平台
  • 个人教程网站有哪些网站做的比较好看的图片
  • 长沙高升小区做汽车行业网站的网络公司论天心区网页设计如何添加网站logo