二叉树
#include<stdio.h>
#include<stdlib.h>
typedef struct bitnode
{
int data;
struct bitnode *left, *right;
} bitnode, *bitree;
bitnode* PerCreateTree()
{
bitnode* T;
int item;
scanf("%d",&item);
if( item == 0)
T =NULL;
else
{
T = (bitnode*)malloc(sizeof(bitnode));
T->data = item;
T->left = PerCreateTree();
T->right = PerCreateTree();
}
return T;
}
void PerOrder(bitnode* T)
{
if( T )
{
printf("%d ",T->data);
PerOrder(T->left);
PerOrder(T->right);
}
}
void hou(bitree T)
{
if( T )
{
hou(T->left);
hou(T->right);
printf("%d ",T->data);
}
}
int count = 0;
int counts(bitnode *T){
if(T){
count ++;
counts(T->left);
counts(T->right);
}
return count;
}