https://pta.patest.cn/pta/test/15/exam/3/question/724

List Reverse( List L )
{
if(L==NULL)
return;
List head=(List)malloc(sizeof(struct Node));
head->Next=NULL;
List q=L,p;
while(q!=NULL)
{
p=q;
q=q->Next;
p->Next=head->Next;
head->Next=p;
}
return head->Next;
}

posted @ 2016-06-09 00:45  胡韬  阅读(1695)  评论(0编辑  收藏  举报