ListNode* Merge(ListNode* pHead1, ListNode* pHead2)
{
if
(pHead1 == NULL)
return
pHead2;
else
if
(pHead2 == NULL)
return
pHead1;
ListNode* pMergedHead = NULL;
if
(pHead1->m_nValue < pHead2->m_nValue)
{
pMergedHead = pHead1;//8
pMergedHead->m_pNext = Merge(pHead1->m_pNext, pHead2);//9
}
else
{
pMergedHead = pHead2;
pMergedHead->m_pNext = Merge(pHead1, pHead2->m_pNext);
}//15
return
pMergedHead;
}
原文:https://www.cnblogs.com/panxuxu/p/10597250.html