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

代理网站地址密云富阳网站建设

代理网站地址,密云富阳网站建设,基于lamp网站建设实例,windows wordpress伪静态一、二叉树相关练习 请编程实现二叉树的操作 1.二叉树的创建 2.二叉树的先序遍历 3.二叉树的中序遍历 4.二叉树的后序遍历 5.二叉树各个节点度的个数 6.二叉树的深度 代码#xff1a; #includestdlib.h #includestring.h #includestdio.h ty…一、二叉树相关练习 请编程实现二叉树的操作 1.二叉树的创建 2.二叉树的先序遍历 3.二叉树的中序遍历 4.二叉树的后序遍历 5.二叉树各个节点度的个数 6.二叉树的深度 代码 #includestdlib.h #includestring.h #includestdio.h typedef struct node//定义二叉树节点结构体 {int data;struct node *left;struct node *right; }*binary; binary create_node()//创建节点并初始化 {binary s(binary)malloc(sizeof(struct node));if(NULLs)return NULL;s-data0;s-leftNULL;s-rightNULL;return s; } binary binary_tree() {int element;printf(please enter element(end0):);scanf(%d,element);if(0element)return NULL;binary treecreate_node();tree-dataelement;tree-leftbinary_tree();tree-rightbinary_tree();return tree; } void first_output(binary tree) {if(treeNULL)return;printf(%d ,tree-data);first_output(tree-left);first_output(tree-right); } void mid_output(binary tree) {if(NULLtree)return;mid_output(tree-left);printf(%d ,tree-data);mid_output(tree-right); } void last_output(binary tree) {if(NULLtree)return;last_output(tree-left);last_output(tree-right);printf(%d ,tree-data); } void limit_tree(binary tree,int *n0,int *n1,int *n2) {if(NULLtree)return;if(tree-lefttree-right)*n2;else if(!tree-left !tree-right)*n0;else*n1;limit_tree(tree-left,n0,n1,n2);limit_tree(tree-right,n0,n1,n2); } int high_tree(binary tree) {if(NULLtree)return 0;int left1high_tree(tree-left);int right1high_tree(tree-right);return leftright?left:right; } int main(int argc, const char *argv[]) {binary treebinary_tree();//创建二叉树first_output(tree);//先序遍历puts();mid_output(tree);//中序遍历puts();last_output(tree);//后序遍历puts();int n00,n10,n20;limit_tree(tree,n0,n1,n2);//计算各个度的节点的个数printf(n0%d,n1%d,n2%d\n,n0,n1,n2);int highhigh_tree(tree);//计算二叉树深度printf(the high of the binary tree is:%d\n,high);return 0; }以下图二叉树为例运行结果 二叉树图 运行
http://www.hkea.cn/news/14325190/

相关文章:

  • 跨境电商网络营销是什么镇江关键字优化公司
  • 珠海网站设计网络管理员考试
  • 网上学习做网站知识付费微网站开发
  • 网站建设模板下载h5网站开发实例教程
  • 四川网站推广c2c平台排名
  • 免费网站在线观看人数在哪怎么做公众号网站
  • 手表网站哪个最好知乎网站建设数据库多少钱
  • 怎么用360做网站跳转网站建设需求分析
  • 江门网站建设方案报价wordpress和阿里云
  • 在线手机网站建设网页设计制作导航栏
  • 网站建设招标说明书搜索引擎优化工具有哪些
  • 宁夏考试教育网站软件代理商招募
  • 淘宝网站开始怎么做linux主机做网站
  • 常州建设网站公司怎么用手机自创游戏
  • 乐清定制网站建设数据型网站 建设方案
  • 怎么看网站pr值商城网站源码
  • 网站seo思路网络营销策略分析论文
  • 创意灵感的网站广东网络推广项目
  • 大连建设培训网济南网站优化技术厂家
  • wordpress回复批准标题优化seo
  • 网站发布信息的基本流程深圳外贸企业网站建设
  • 国外无版权素材网站wordpress 虚拟浏览量
  • 网站哪里做wordpress固定链接 404
  • 微信公众号免费做影视网站西安比较好的网络公司
  • 校考前做试题的网站做网站找人
  • 网站代码怎么放百度收录网站需要多久
  • 博物馆设计网站推荐做出口网站
  • 网络宣传网站建设定制构建网站无障碍建设
  • 学校网站建设及管理制度黄冈app下载推广平台
  • 做亚马逊常用的网站凌峰wordpress百度云