/* 数据结构分析与学习专栏
* Copyright (c) 2015, 山东大学 计算机科学与技术专业 学生
* All rights reserved.
* 作 者: 高祥
* 完成日期: 2015 年 4 月 13 日
* 版 本 号:019
*任务描述:针对二叉树遍历,实现8种方法
* 1:建立二叉树 ;
* 2:层序输出二叉树 ;
* 3:判断二叉树是否为空 ;
* 4:求二叉树的高度 ;
* 5:求二叉树的总结点数;
* 6:求二叉树的度为1的结点数 ;
* 7:求二叉树的叶子结点数;
* 8:销毁二叉树;
*主要函数:
* 1.void CreateByPreOrder(BinaryTree &T);//给定完整的先序遍历建树
* 2.void LevelTraverse(BinaryTree T);//层次遍历
* 3.int IsEmpty(BinaryTree T);//判断二叉树是否为空
* 4.int BinaryTreeHeight(BinaryTree T);//求树的高度
* 5.int NodeCount(BinaryTree T);//求二叉树结点的总数
* 6.int DegreeOneCount(BinaryTree T);//求度为1的结点的总数
* 7.int LeafNodeCount(BinaryTree T);//求叶子结点总数
* 8.void DestroyBinaryTree(BinaryTree &T);//销毁二叉树
*/
#include<iostream>
#include<queue>
#include<algorithm>
#include<cstdlib>
using
二叉树(二叉链式存储)8种基本操作的实现
最新推荐文章于 2023-08-30 16:16:05 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)