亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

蟲蟲首頁| 資源下載| 資源專輯| 精品軟件
登錄| 注冊

Postorder

  • Very good Java Applet used to animate Inserting, Deleting and Searching (Preorder & Postorder algori

    Very good Java Applet used to animate Inserting, Deleting and Searching (Preorder & Postorder algorithm) nodes in Binary Trees. This is a part of mine students project. You can use and redistribute the source code absolutelly free!

    標簽: Inserting Searching Postorder Deleting

    上傳時間: 2014-01-25

    上傳用戶:蟲蟲蟲蟲蟲蟲

  • TwoEmbranchmentTree:As ancestor has its children , a tree has its leaves. we could check its leaves

    TwoEmbranchmentTree:As ancestor has its children , a tree has its leaves. we could check its leaves in terms of algorithm as preorder , midorder or Postorder.

    標簽: leaves its TwoEmbranchmentTree has

    上傳時間: 2013-12-11

    上傳用戶:電子世界

  • 二叉樹子系統

    #include<stdio.h> #define TREEMAX 100 typedef struct  BT { char data; BT *lchild; BT *rchild; }BT; BT *CreateTree(); void Preorder(BT *T); void Postorder(BT *T); void Inorder(BT *T); void Leafnum(BT *T); void Nodenum(BT *T); int TreeDepth(BT *T); int count=0; void main() { BT *T=NULL; char ch1,ch2,a; ch1='y'; while(ch1=='y'||ch1=='y') { printf("\n"); printf("\n\t\t             二叉樹子系統"); printf("\n\t\t*****************************************"); printf("\n\t\t           1---------建二叉樹            "); printf("\n\t\t           2---------先序遍歷            "); printf("\n\t\t           3---------中序遍歷            "); printf("\n\t\t           4---------后序遍歷            "); printf("\n\t\t           5---------求葉子數            "); printf("\n\t\t           6---------求結點數            "); printf("\n\t\t           7---------求樹深度            "); printf("\n\t\t           0---------返    回            "); printf("\n\t\t*****************************************"); printf("\n\t\t      請選擇菜單號 (0--7)"); scanf("%c",&ch2); getchar(); printf("\n"); switch(ch2) { case'1': printf("\n\t\t請按先序序列輸入二叉樹的結點:\n"); printf("\n\t\t說明:輸入結點(‘0’代表后繼結點為空)后按回車。\n"); printf("\n\t\t請輸入根結點:"); T=CreateTree(); printf("\n\t\t二叉樹成功建立!\n");break; case'2': printf("\n\t\t該二叉樹的先序遍歷序列為:"); Preorder(T);break; case'3': printf("\n\t\t該二叉樹的中序遍歷序列為:"); Inorder(T);break; case'4': printf("\n\t\t該二叉樹的后序遍歷序列為:"); Postorder(T);break; case'5': count=0;Leafnum(T); printf("\n\t\t該二叉樹有%d個葉子。\n",count);break; case'6': count=0;Nodenum(T); printf("\n\t\t該二叉樹總共有%d個結點。\n",count);break; case'7': printf("\n\t\t該樹的深度為:%d",TreeDepth(T)); break; case'0': ch1='n';break; default: printf("\n\t\t***請注意:輸入有誤!***"); } if(ch2!='0') { printf("\n\n\t\t按【Enter】鍵繼續,按任意鍵返回主菜單!\n"); a=getchar(); if(a!='\xA') { getchar(); ch1='n'; } } } } BT *CreateTree() { BT *t; char x; scanf("%c",&x); getchar(); if(x=='0') t=NULL; else { t=new BT; t->data=x; printf("\n\t\t請輸入%c結點的左子結點:",t->data);         t->lchild=CreateTree(); printf("\n\t\t請輸入%c結點的右子結點:",t->data);         t->rchild=CreateTree();     } return t; } void Preorder(BT *T) { if(T) { printf("%3c",T->data); Preorder(T->lchild); Preorder(T->rchild); } } void Inorder(BT *T) { if(T) { Inorder(T->lchild); printf("%3c",T->data); Inorder(T->rchild); } } void Postorder(BT *T) { if(T) { Postorder(T->lchild); Postorder(T->rchild); printf("%3c",T->data); } } void Leafnum(BT *T) { if(T) { if(T->lchild==NULL&&T->rchild==NULL) count++; Leafnum(T->lchild); Leafnum(T->rchild); } } void Nodenum(BT *T) { if(T) { count++; Nodenum(T->lchild); Nodenum(T->rchild); } } int TreeDepth(BT *T) { int ldep,rdep; if(T==NULL) return 0; else { ldep=TreeDepth(T->lchild); rdep=TreeDepth(T->rchild); if(ldep>rdep) return ldep+1; else return rdep+1; } }

    標簽: 二叉樹 子系統

    上傳時間: 2020-06-11

    上傳用戶:ccccy

主站蜘蛛池模板: 依兰县| 台东县| 兴安盟| 射洪县| 万全县| 册亨县| 平江县| 土默特右旗| 青州市| 融水| 曲阜市| 肃北| 丽水市| 松阳县| 盐城市| 赤壁市| 蓝田县| 尼玛县| 友谊县| 连南| 千阳县| 漯河市| 缙云县| 洛隆县| 姜堰市| 永修县| 黄浦区| 清原| 保定市| 龙山县| 应用必备| 宝山区| 疏勒县| 赤峰市| 大同市| 和顺县| 土默特左旗| 精河县| 广河县| 阿合奇县| 宁乡县|