typedef struct node
{
int data;
struct node *next;
}Node;
Node *reverseNode(Node *head)
{
Node *p, *q, *r;
if(head==NULL || head->next==NULL)
return head;
p=head->next;
q=p->next;
r=q->next;
p->next=NULL;
while(r != NULL)
{
q->next=p;
p=q;
q=r;
r=r->next;
}
q->next=p;
head->next=q;
return head;
}
阅读(841) | 评论(0) | 转发(0) |