阳光板的安装:一个二叉树的题目

来源:百度文库 编辑:中科新闻网 时间:2024/04/29 13:58:15
建立完全二叉树利用数组

看看这个

#define NULL 0
struct maillist
{int num;
char address[10];
sturct maillist *next;
};
int n;
struct miallist *creat(void)
{struct maillist *p1,*p2;
n=0;
p1=p2=(struct student*)malloc(LEN);
scanf("%ld,%ld",&p1->num,&p1->address);
head=NULL;
while(p1->num!=0)
{n=n+1;
if(n++1)head=p1;
else
p2->next=p1;
p2=p1;
p1=(struct maillist*)malloc(LEN);
scanf("%ld,%s",&

每个数组元素作一个节点,每个节点里有指针指着其它节点!很easy啊!