单链表翻转
void ReverseLink(ListNode *&pHead)
{
if (NULL == pHead)
{
return;
}
ListNode *pNode = pHead;
ListNode *Prev = NULL;
ListNode *pNext = NULL;
while (NULL != pNode)
{
pNext = pNode->m_pNext;
if (NULL == pNext)
{
pHead = pNode;
}
pNode->m_pNext = Prev;
Prev = pNode;
pNode = pNext;
}
}