ListNode* ReverseList(ListNode* pHead)
{
ListNode* newh = NULL;
for(ListNode* p = pHead; ;p=p->next )//p爲工作指針
{
p -> next = newh;
newh = p;
}
return newh;
}
ListNode* ReverseList(ListNode* pHead)
{
ListNode* newh = NULL;
for(ListNode* p = pHead; ;p=p->next )//p爲工作指針
{
p -> next = newh;
newh = p;
}
return newh;
}