逆序建链表并删除重复元素:
struct node *Operate(struct node *head,int n)
{
struct node *p,*q,*x;
p = head->next;
while(p != NULL)
{
q = p->next;
x = p;
while(q != NULL)
{
if(p->data != q->data)
{
q = q->next;
x = x->next;
}
else
{
x->next = q->next;
q =q->next;
n--;
}
}
p = p->next;
}
printf("%d\n",n);
return head;
};