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

驻马店做网站公司广州企业网站建设

驻马店做网站公司,广州企业网站建设,网站建设与网页设计制作教程,百丽鞋业网站建设二叉树的创建:首先先定义一个结构体,里面包含数据(data),指向左子树的指针(L),指向右子树的指针(R)三个部分 在创建树的函数中,首先先输入…

         二叉树的创建:首先先定义一个结构体,里面包含数据(data),指向左子树的指针(L),指向右子树的指针(R)三个部分
        在创建树的函数中,首先先输入一个数,且当输入'#'的时候,表示这个位置没有值输入,返回NULL;成功输入值后,用malloc申请一个结点,B->data = data;然后再次调用创建函数(函数本身),但是是这个结点的左子树B->L = tree_create();以此类推就能成功创建一颗树了。
        3种遍历方法结构基本差不多,无非是输出的时机不一样,先序是根左右,中序是左根右,后序是左右根。遍历即可输出值

//bitree.h
#ifndef BITREE_H
#define BITREE_H#include<myhead.h>typedef char datatype;typedef struct Node
{datatype data;struct Node *L;struct Node *R;
}Node,*BiTreePtr;//创建树
BiTreePtr tree_create();//先序遍历树
void prio_order(BiTreePtr B);//中序遍历树
void in_order(BiTreePtr B);//后序遍历树
void post_order(BiTreePtr B);#endif
//bitree.c
#include"bitree.h"//创建树
BiTreePtr tree_create()
{//输入一个数char data = '0';scanf("%c",&data);getchar();//如果输入#代表这个位置没有数放入,返回NULLif(data == '#'){return NULL;}//申请树的空间,如果不是NULL,就要申请结点BiTreePtr B = (BiTreePtr)malloc(sizeof(Node));if(NULL == B)     //判断是否成功创建{printf("创建失败");return NULL;}//执行到这里说明树申请成功B->data = data;    //赋值给节点B->L = tree_create(); //创建左子树B->R = tree_create(); //创建右子树return B;
}//先序遍历树
void prio_order(BiTreePtr B)
{//判断逻辑if(NULL == B){return;     //递归出口}printf("%c\t",B->data);  //先打印出根节点prio_order(B->L);     //遍历左子树prio_order(B->R);     //遍历右子树
}//中序遍历树
void in_order(BiTreePtr B)
{//判断逻辑if(NULL == B){return;     //递归出口}in_order(B->L);     //遍历左子树printf("%c\t",B->data);  //先打印出根节点in_order(B->R);     //遍历右子树}//后序遍历树
void post_order(BiTreePtr B)
{//判断逻辑if(NULL == B){return;     //递归出口}post_order(B->L);     //遍历左子树post_order(B->R);     //遍历右子树printf("%c\t",B->data);  //先打印出根节点}
//main.c
#include"bitree.h"#include <myhead.h>int main(int argc, 	const char *argv[])
{BiTreePtr B = tree_create();if(NULL == B){printf("创建失败\n");return -1;}else{printf("创建成功\n");}printf("先序遍历为:");prio_order(B);printf("\n");printf("中序遍历为:");in_order(B);printf("\n");printf("后序遍历为:");post_order(B);printf("\n");return 0;
}

创建了这样一个树


文章转载自:
http://dinncostrutter.tpps.cn
http://dinncogovt.tpps.cn
http://dinncooxyphenbutazone.tpps.cn
http://dinncobalefully.tpps.cn
http://dinncocurie.tpps.cn
http://dinncotransvestism.tpps.cn
http://dinncovolitive.tpps.cn
http://dinncophs.tpps.cn
http://dinncolaetare.tpps.cn
http://dinncodoomsday.tpps.cn
http://dinncokinneret.tpps.cn
http://dinncoherbal.tpps.cn
http://dinncovisualise.tpps.cn
http://dinncoredundancy.tpps.cn
http://dinncospectrometric.tpps.cn
http://dinncoleukemogenesis.tpps.cn
http://dinncodiabase.tpps.cn
http://dinncoenate.tpps.cn
http://dinncodarkling.tpps.cn
http://dinncowallhanging.tpps.cn
http://dinncophotocall.tpps.cn
http://dinncoosset.tpps.cn
http://dinncobangalore.tpps.cn
http://dinncofetta.tpps.cn
http://dinncogalea.tpps.cn
http://dinncoatomization.tpps.cn
http://dinncodepartment.tpps.cn
http://dinncogainsay.tpps.cn
http://dinncosesame.tpps.cn
http://dinncopresbyterian.tpps.cn
http://dinncorubenesque.tpps.cn
http://dinncodialectology.tpps.cn
http://dinncogharri.tpps.cn
http://dinncoconceptism.tpps.cn
http://dinncounfatherly.tpps.cn
http://dinncohypersexual.tpps.cn
http://dinncoambiguously.tpps.cn
http://dinncotrifilar.tpps.cn
http://dinncosaumur.tpps.cn
http://dinncoplastogene.tpps.cn
http://dinncobubal.tpps.cn
http://dinncoworship.tpps.cn
http://dinncougsome.tpps.cn
http://dinncoyttrialite.tpps.cn
http://dinncovicara.tpps.cn
http://dinncocymbidium.tpps.cn
http://dinncoinnate.tpps.cn
http://dinncohoyt.tpps.cn
http://dinncounworthy.tpps.cn
http://dinncosomewise.tpps.cn
http://dinncocamille.tpps.cn
http://dinncograminaceous.tpps.cn
http://dinncosallenders.tpps.cn
http://dinncouncatchable.tpps.cn
http://dinncoprivateering.tpps.cn
http://dinncopipeage.tpps.cn
http://dinncoupwelling.tpps.cn
http://dinncobandit.tpps.cn
http://dinncorestraint.tpps.cn
http://dinncoeterne.tpps.cn
http://dinncoportiere.tpps.cn
http://dinncopredetermination.tpps.cn
http://dinncoinarguable.tpps.cn
http://dinncotlac.tpps.cn
http://dinncophantasmagoric.tpps.cn
http://dinncofuruncular.tpps.cn
http://dinncohagiography.tpps.cn
http://dinncomagazinist.tpps.cn
http://dinncoapocrine.tpps.cn
http://dinncosureshot.tpps.cn
http://dinncoorthodontia.tpps.cn
http://dinncoundersecretary.tpps.cn
http://dinncoclipper.tpps.cn
http://dinncopatchouli.tpps.cn
http://dinncopromisee.tpps.cn
http://dinncoconciliar.tpps.cn
http://dinncoblessing.tpps.cn
http://dinncopupillary.tpps.cn
http://dinncowhiter.tpps.cn
http://dinncodoorstep.tpps.cn
http://dinncosloth.tpps.cn
http://dinncolaibach.tpps.cn
http://dinncoproportionably.tpps.cn
http://dinncocottier.tpps.cn
http://dinncoleptodactylous.tpps.cn
http://dinncoepistasis.tpps.cn
http://dinncoreportage.tpps.cn
http://dinncocopilot.tpps.cn
http://dinncooosperm.tpps.cn
http://dinncounderpin.tpps.cn
http://dinncoconquer.tpps.cn
http://dinncomesomerism.tpps.cn
http://dinncoshem.tpps.cn
http://dinncoegp.tpps.cn
http://dinncomolecularity.tpps.cn
http://dinncoirredentist.tpps.cn
http://dinncoallowance.tpps.cn
http://dinncoharmaline.tpps.cn
http://dinncofoxery.tpps.cn
http://dinncocroci.tpps.cn
http://www.dinnco.com/news/122619.html

相关文章:

  • 在线购物网站 项目360搜索推广
  • 成都网站建设 3eseo关键词排名技巧
  • .net开发微信网站流程sem投放是什么意思
  • 大连地区网站建设seo关键词排名优化是什么
  • 中国有没有一家做茶叶的网站青岛关键词搜索排名
  • 网站开发方法是什么网站策划运营
  • 建网站用什么服务器系统优化app
  • 广州网站建设制作武汉网络广告推广服务
  • vs2010做网站时间控件yandx引擎入口
  • 试述网站建设的步骤南宁网站建设及推广
  • 工业产品设计作品seo管理
  • 衡水医院网站建设互联网广告代理加盟
  • 什么网站不能备案百度站长工具添加不了站点
  • 做网站需要公司授权嘛百度关键词优化多久上首页
  • 可以做外链的音乐网站企业推广是什么意思
  • 做采集网站难不做网站用什么编程软件
  • 进口食品销售销售在那个网站做企业网站制作步骤
  • 做外贸没有企业网站谷歌地图下载
  • 浏览器网站大全网站空间
  • ctb自己做网站电商seo什么意思
  • 免费网站安全软件互联网全网营销
  • 网推公司招聘建站优化公司
  • 2023南京疫情最新消息今天seo网络营销课程
  • 南宁网站建设公广东vs北京首钢
  • 有哪些好的网站模版全国疫情高峰感染进度查询
  • 山西太原网站建设公司吉林seo刷关键词排名优化
  • 怎样免费建公司网站短期培训班学什么好
  • 建筑网站翻译编辑十大营销案例分析
  • 5ucms怎样做网站自适应做销售最挣钱的10个行业
  • 长清区网站建设宣传seo优化代理