Data structure Binary tree operations (C language)
发布时间
阅读量:
阅读量
//二叉树操作
#include"stdio.h"
#include"stdlib.h"
typedef struct node{
char data;
struct node *lchild,*rchild;
}bintnode;
typedef bintnode *bintree;
typedef struct stack
{
bintree data[100];
int tag[100];
int top;
}stack;
//压栈
void push(stack *s, bintree t)
{
s->data[s->top]=t;
s->top++;
}
//出栈
bintree pop(stack *s)
{
if(s->top!=0)
{
s->top--;
return (s->data[s->top]);
}
else
return NULL;
}
//创建(前序)
bintree cr
全部评论 (0)
还没有任何评论哟~
