ListNode * Reverse(ListNode *pHead)
{
if (pHead == NULL)
return NULL;
ListNode * pNewHead = NULL;
ListNode * pCur = pHead;
ListNode * pLast = NULL;
while (pCur != NULL) {
pLast = pCur->next;
pCur->next = pNewHead;
pNewHead = pCur;
pCur = pLast;
}
return pNewHead;
}反转单链表
最新推荐文章于 2022-09-21 21:52:47 发布
1382

被折叠的 条评论
为什么被折叠?



