需实现:(1)输出二叉树b的节点个数
(2)输出二叉树b的叶子节点个数
(3)求二叉树b中指定节点值(假设所有节点值不同)的节点的层次。
(4)利用层次遍历求二叉树b的宽度
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
const int MaxSize=10000;
using namespace std;
typedef struct node
{
char data;
struct node * lchild;
struct node * rchild;
}BTNode;
typedef struct qnode
{
BTNode *data;
struct qnode *next;
}DataNode;
typedef struct
{
int Size;
DataNode *front;
DataNode *rear;
}SqQueue;
void InitQueue(SqQueue * &q)
{
q=(SqQueue *)malloc(sizeof(SqQueue));
q->front=q->rear=NULL;
q->Size=0;
}
bool QueueEmpty(SqQueue *q)
{
return (q->rear==NULL);
}
void enQueue(SqQueue * &q,BTNode *e)
{
DataNode *p;
p=(DataNode *)malloc(size