freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

數(shù)據(jù)結(jié)構(gòu)及其應(yīng)用(算法與數(shù)據(jù)結(jié)構(gòu)課程設(shè)計(jì))word格式-文庫吧

2025-01-01 17:03 本頁面


【正文】 能是調(diào)要相關(guān)函數(shù)實(shí)現(xiàn)問題的求解。六、數(shù)據(jù)結(jié)構(gòu):二叉樹的抽象數(shù)據(jù)類型結(jié)構(gòu)定義:typedef struct Node { TElemType data。 struct Node *lchild,*rchild。 } BiTNode, *BiTreeLink。同學(xué)錄節(jié)點(diǎn)信息:typedef struct Info{ char name[20]。 //姓名 char date[11]。 //生日 char phone[12]。 //電話 char StudentNum[11]。//學(xué)號}DataType。同學(xué)錄數(shù)據(jù)存儲結(jié)構(gòu):typedef struct Node { DataType data。 struct Node *left,*right。 }BTNode, *PBTNode,*BiTree。七、源程序:在順序二叉樹下求節(jié)點(diǎn)所在層次數(shù)define maxlen 100includetypedef struct node { char data。 } Bitree[maxlen]。 int N。 Bitree T。/*建立二叉樹*/void Creattree(){ int i。 char c。 printf(請輸入結(jié)點(diǎn)數(shù)目(包括空結(jié)點(diǎn)):)。 scanf(%d,amp。N)。 printf(請輸入結(jié)點(diǎn)(空結(jié)點(diǎn)為0):)。 for(i=1。i=N。i++) { scanf(%s,amp。c)。 T[i].data=c。 }}/*求二叉樹節(jié)點(diǎn)所在層次*/void Cengcitree(){ int i,m=0,count=1。 char c。 printf(請輸入某一結(jié)點(diǎn):)。 scanf(%s,amp。c)。 i=1。 while(i=N) { if(T[i].data==c){m=i。 break。} i++。 } if (m==0) printf(\n節(jié)點(diǎn)不存在)。 while(m!=1) { m=m/2。 count++。 } printf(\n節(jié)點(diǎn)所在層次:%d\n,count)。}/*主函數(shù)*/void main(){ Creattree()。 Cengcitree()。}在鏈?zhǔn)蕉鏄湎虑蠊?jié)點(diǎn)所在層次數(shù)include include include define MAXSIZE 20define NULL 0typedef char TElemType。/* 二叉鏈樹的類型定義*/typedef struct BiTNode { TElemType data。 struct BiTNode *lchild,*rchild。 } BiTNode, *BiTreeLink。/*先序建立二叉樹*/int CreateBiTree(BiTreeLink *T){ char ch。 scanf(%c,amp。ch)。 if (ch==39。 39。) *T=NULL。 else { *T=(BiTreeLink)malloc(sizeof(BiTNode))。 if (!(*T)) return 0。 /* 未分配到空間錯誤返回*/ (*T)data=ch。 CreateBiTree(amp。(*T)lchild)。 CreateBiTree(amp。(*T)rchild)。 } return 1。 }/* 先序遍歷二叉樹*/void PreOrderTraverse(BiTreeLink T){ if (T) { printf(%c,Tdata)。 PreOrderTraverse(Tlchild)。 PreOrderTraverse(Trchild)。 }}/*求二叉樹節(jié)點(diǎn)所在層次數(shù)*/int CengciTree(BiTreeLink T,char c){ int n=1,front=0,rear=0,flag。 BiTreeLink queue[MAXSIZE]。// if(!T) { printf(樹為空!\n)。 return n。 }if(Tdata==c) return n。queue[rear++]=Tlchild。 queue[rear++]=Trchild。 queue[rear++]=T。 n++。while((front+1)%MAXSIZE!=rear) { flag=0。 if(queue[front]amp。amp。queue[front]data
點(diǎn)擊復(fù)制文檔內(nèi)容
試題試卷相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1