数据结构课程设计之-树与二叉树的转换(12)

时间:2026-01-20   来源:未知    
字号:

//层次遍历

void level(PTree T) { int i; for(i=0;i<T.count;i++) { printf("%d ",T.node[i]); } }

//水平输出二叉树

void PrintBTree(BTNode *root,int level) { int i;

if(root!=NULL) {

PrintBTree(root->rightsib,level+1); for(i=1;i<=8*level;i++) printf(" ");

printf("-------%d\n",root->data); PrintBTree(root->firstchild,level+1); } }

//输出树

void print_ptree(PTree tree) {

int i;

printf(" 序号 结点 双亲\n"); for(i=0;i<=tree.count;i++) {

printf("%8d%8d%8d",i,tree.node[i].data,tree.node[i].parent); printf("\n"); } }

/*用双亲表示法创建树*/ PTree CreatTree(PTree T) {

数据结构课程设计之-树与二叉树的转换(12).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:19 元/月 原价:99元
低至 0.1 元/份 每月下载300
全站内容免费自由复制
VIP包月下载
特价:19 元/月 原价:99元
低至 0.1 元/份 每月下载300
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)