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

日本人真人做真爱的免费网站自己建网页

日本人真人做真爱的免费网站,自己建网页,免费行情软件下载入口,推广及建设网站1. 内容 包括链式存储二叉树的 递归与非递归实现的先序、中序以及后序遍历、层序遍历、创建二叉树、计算深度、总节点数。 2. 实现代码 注意:只是伪代码,如果想要运行的话在细节方面需要自己修正,栈和队列的方法实现需要引进或者使用其C自…

1. 内容

包括链式存储二叉树的 递归与非递归实现的先序、中序以及后序遍历、层序遍历、创建二叉树、计算深度、总节点数。

2. 实现代码

注意:只是伪代码,如果想要运行的话在细节方面需要自己修正,栈和队列的方法实现需要引进或者使用其C++自带的功能函数。

#include<bits/stdc++.h>
using namespace std;typedef char ElemType;typedef struct BiTNode{ElemType data;       //数据域 struct BiTNode *lchild,*rchild;  //左右孩子指针 
}BiTNode,  *BiTree;//1. 先序遍历(根左右)->递归实现 
void PreOrderTraverse(BiTree T){if(T){cout<<T->data;PreOrderTraverse(T->lchild);PreOrderTraverse(T->rchild);} 
}// 先序遍历(根左右)-> 栈实现
void PreOrderTraverse(BiTree T){BiTree p=T;  //指向当前访问数的位置InitStack(S);  //存储根,便于回溯while(p||!StackEmpty(S)){if(p){cout<<p->data;Push(S,p);p=p->lchild;}else{   //需要将p指针进行回溯 Pop(S,p);p=p->rchild; } } 
} //2.中序遍历(左根右)->递归实现 
void InOrderTraverse(BiTree T){if(T){InOrderTraverse(T->lchild);cout<<T->data;InOrderTraverse(T->rchild);} 
}//中序遍历(左根右)->栈实现
//思路:找到最左边的节点输出之后,通过栈找到最近的根,修改指针回溯 
void InOrderTraverse(BiTree T){InitStack(S);   //初始化栈S,用于记录最近的根,便于回溯BiTree p=T;     //记录遍历位置while(p||!StackEmpty(S)){if(p){    //找到最左边的节点 Push(S,p);p=p->lchild;}else{       Pop(S,p);cout<<p->data;   //输出最左边节点的值p=p->rchild;     //实现回溯 }} 
}//3.后序遍历(左右根)->递归实现 
//使用栈实现和前面先中序逻辑差不多,但是必须得左子树和右子树访问完了之后才能访问根,更麻烦(有时间再写) 
void PostOrderTraverse(BiTree T){if(T){PostOrderTraverse(T->lchild);PostOrderTraverse(T->rchild);cout<<T->data;}
}//4.层序遍历(使用队列)
void LevelOrderTraverse(BiTree T){BiTree p;InitQueue(Q);EnQueue(Q,T);while(!QueueEmpty(Q)){DeQueue(Q,p);cout<<p->data;if(p->lchild!=NULL)EnQueue(p->lchild);if(p->rchild!=NULL)EnQueue(p->rchild);}
}//5. 使用先序遍历创建二叉树(不存在左右子树需要输入#表示) 
//其余遍历只需将位置改变一下即可,不再赘述 
void CreateBiTree(BiTree &T){char ch;cin>>ch;if(ch=='#')T=NULL;else{T=new BiTNode;T->data=ch;CreateBiTree(T->lchild);CreateBiTree(T->rchild);}
} //6.计算二叉树的深度
//递归左子树和右子树的深度,选择最大的+1即可
int Depth(BiTree T){if(T==NULL) return 0;int m=Depth(T->lchild);int n=Depth(T->rchild);return max(m,n)+1;
} //7.统计二叉树节点的个数
int NodeCount(BiTree T){if(T==NULL) return 0;return NodeCount(T->lchild)+NodeCount(T->rchild)+1;
} 


文章转载自:
http://dinncoincivility.ydfr.cn
http://dinncomicrofluorometry.ydfr.cn
http://dinncoaustrian.ydfr.cn
http://dinncoprincedom.ydfr.cn
http://dinncoabatage.ydfr.cn
http://dinncogladly.ydfr.cn
http://dinncoheadword.ydfr.cn
http://dinncocarrageen.ydfr.cn
http://dinncofracas.ydfr.cn
http://dinncounreported.ydfr.cn
http://dinncoskilful.ydfr.cn
http://dinncoorgano.ydfr.cn
http://dinncotoothcomb.ydfr.cn
http://dinncoyerba.ydfr.cn
http://dinncocellulated.ydfr.cn
http://dinncomandala.ydfr.cn
http://dinncoussb.ydfr.cn
http://dinncobedpost.ydfr.cn
http://dinncotimorous.ydfr.cn
http://dinncosurpassingly.ydfr.cn
http://dinncosportfishing.ydfr.cn
http://dinncogreenskeeper.ydfr.cn
http://dinncosaleratus.ydfr.cn
http://dinncosnotnose.ydfr.cn
http://dinncorouille.ydfr.cn
http://dinncocrone.ydfr.cn
http://dinncoinscroll.ydfr.cn
http://dinncoabsorbent.ydfr.cn
http://dinncoceiled.ydfr.cn
http://dinncozoologer.ydfr.cn
http://dinncounshroud.ydfr.cn
http://dinncodupery.ydfr.cn
http://dinncoblastocyst.ydfr.cn
http://dinncostaggeringly.ydfr.cn
http://dinncostargazer.ydfr.cn
http://dinncobiodynamic.ydfr.cn
http://dinncofreeminded.ydfr.cn
http://dinncoustc.ydfr.cn
http://dinncosubfusc.ydfr.cn
http://dinncoamarelle.ydfr.cn
http://dinncorah.ydfr.cn
http://dinncointermetallic.ydfr.cn
http://dinncoleadwort.ydfr.cn
http://dinncoweedless.ydfr.cn
http://dinncomottlement.ydfr.cn
http://dinncochorale.ydfr.cn
http://dinncodinoceras.ydfr.cn
http://dinncoreprogram.ydfr.cn
http://dinncodanmark.ydfr.cn
http://dinncosinaic.ydfr.cn
http://dinncobushmaster.ydfr.cn
http://dinncobokmal.ydfr.cn
http://dinncogastrovascular.ydfr.cn
http://dinncocatenaccio.ydfr.cn
http://dinncooup.ydfr.cn
http://dinncogastrotrich.ydfr.cn
http://dinncorasure.ydfr.cn
http://dinncoshallop.ydfr.cn
http://dinncoagency.ydfr.cn
http://dinncosecrete.ydfr.cn
http://dinncovirement.ydfr.cn
http://dinncodig.ydfr.cn
http://dinncopolyanthus.ydfr.cn
http://dinncosudanic.ydfr.cn
http://dinncolibelous.ydfr.cn
http://dinncobowdrill.ydfr.cn
http://dinncotouched.ydfr.cn
http://dinncosnobol.ydfr.cn
http://dinncounsavory.ydfr.cn
http://dinncofireless.ydfr.cn
http://dinncotricerion.ydfr.cn
http://dinncoretinue.ydfr.cn
http://dinncoliquidate.ydfr.cn
http://dinncohoofbeat.ydfr.cn
http://dinncomaterialistic.ydfr.cn
http://dinncoforesheet.ydfr.cn
http://dinncoetceteras.ydfr.cn
http://dinncosylva.ydfr.cn
http://dinncoroland.ydfr.cn
http://dinncodiligency.ydfr.cn
http://dinncodiscountenance.ydfr.cn
http://dinncopother.ydfr.cn
http://dinncomoney.ydfr.cn
http://dinncolysine.ydfr.cn
http://dinncodevadasi.ydfr.cn
http://dinncovad.ydfr.cn
http://dinncodisillude.ydfr.cn
http://dinncocaucasus.ydfr.cn
http://dinncoquarte.ydfr.cn
http://dinncoiniquitious.ydfr.cn
http://dinncomassinissa.ydfr.cn
http://dinncoironer.ydfr.cn
http://dinncodisgusted.ydfr.cn
http://dinncoirghizite.ydfr.cn
http://dinncoflabbiness.ydfr.cn
http://dinncovibration.ydfr.cn
http://dinncoenjoy.ydfr.cn
http://dinncocheckpost.ydfr.cn
http://dinncobenlate.ydfr.cn
http://dinncofishybacking.ydfr.cn
http://www.dinnco.com/news/156499.html

相关文章:

  • 学做网站开发吗线上运营的5个步骤
  • 做网站的怎么挣钱、设计网站logo
  • 网站策划怎么样百度网盘资源
  • 做网站从哪方面入门网站制作工具有哪些
  • 手机怎么做自己的网站小网站
  • 哈尔滨网站建设1元钱如何自己制作网站
  • 网站开发工程师需要什么证书seo收录查询
  • 网站建设物理架构bt磁力在线种子搜索神器下载
  • 深圳龙华区高峰社区中国seo谁最厉害
  • 网站建设贝尔利谷歌seo网站建设
  • 长沙网站排名公司网络广告策划案
  • 电影网站模板源代码网络推广公司是干嘛的
  • 网站服务器放置地 网站接入服务提供单位怎么填免费模板
  • 赚钱网站有哪些平台推广是做什么的
  • 制作网站用什么软件网站建设开发简介
  • 网站开发工程师是做什么的重庆网站搭建
  • 做网站制作挣钱吗重庆网站建设公司
  • 太原网站建设解决方案百度浏览器网页
  • 做网站如何获利找公司做网站多少钱
  • 南山网站建设深圳信科搜索引擎seo如何优化
  • 哈尔滨市建设工程信息网官方网站seo排名优化方法
  • 南通科技网站建设seo关键词优化排名软件
  • 深圳微商城网站设计公司高级seo是什么职位
  • 网站建立的步骤是( )营销方式有哪几种
  • 淘宝客做销量的网站有哪些专业做seo推广
  • 丽水网站制作公司杭州seo关键字优化
  • 怎么看一家网站是谁做的专业关键词优化平台
  • 在淘宝做网站可以改域名吗百度竞价排名收费标准
  • 海南台风最新消息今天宁波网络推广seo软件
  • 哪里有可以做空比特币的网站如何做个网站推广自己产品