程序填空删除单链表中重复结点,重复结点只保留一个,head是单链表首结点指针
struct node "delete(struct node *head)
{
struct node *p,"q,"r,*tmp; //r指向q的前驱结点
p=q=head;
for(p=head; ( );p=p-> next)
{r=p;
for(q=p->next;q!=NULL;)
if(q->x==p->x)
{( );
tmp=q;
q=q->next;
free(tmp);)
else
(r=q;( );}
}
( );//返回删除重复结点的单链表头
}
数据结构对单链表进行数据排序 http://bbs.csdn.net/topics/392201633