注册 登录
编程论坛 数据结构与算法

帮我解释一下这几个句子的意义吧

妄想之渡 发布于 2013-07-01 14:52, 760 次点击
TScore Insert_Creat(TScore tree,int co,int id,char name)
{
   TScore p,f,q;
   Linklist tr,i,j;
   p=tree;f=NULL;
    while(p&&p->score!=co)     
    {   
         f=p;
        if(p->score>co)
            p=p->lchild;
        else p=p->rchild;
    }
if(p==NULL)
{
    q=(TScore)malloc(sizeof(Tree_Score));
    q->score=co;
    q->lchild=q->rchild=NULL;
    tr=q->list;
    tr=(Linklist)malloc(sizeof(student));
    tr->id=id;
    tr->next=NULL;
    if(tree==NULL) tree=q;//这里是什么意思
    else if(co<f->score)//同上
    f->lchild=q;//同上
    else f->rchild=q;//同上
}
else if(p->score==co)
{
     i=p->list;
     while(i)
     {
             j=i;i=i->next;
             }
             i=(Linklist)malloc(sizeof(student));
             j->next=i;
             i->id=id;
             i->name=name;
             i->next=NULL;
             }
             return tree;
             }
0 回复
1