中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

合并兩個已序單鏈表

發布時間:2020-08-05 23:20:28 來源:網絡 閱讀:276 作者:淺唱逝流年 欄目:編程語言

// 合并兩個已序單鏈表

PSListNode MergeList(PSListNode pL1, PSListNode pL2)

{

                 PSListNode pNewHead = NULL ;

                 PSListNode pL1Node = pL1 ;

                 PSListNode pL2N0de = pL2 ;

                 PSListNode pNode = NULL ;

                 PSListNode pTailNode = NULL ;

                 if (pL1 == NULL)

                {

                                 return pL2 ;

                }

                 if (pL2 == NULL)

                {

                                 return pL1 ;

                }

                 if (pL1Node->data > pL2N0de->data)

                {

                                pNode = pL2N0de;

                                pL2N0de = pL2N0de->pNext;

                }

                 else

                {

                                pNode = pL1Node;

                                pL1Node = pL1Node->pNext;

                }

                pNewHead = pNode;

                pTailNode = pNode;

                 while (pL1Node&&pL2N0de)

                {

                                 if (pL1Node->data > pL2N0de->data)

                                {

                                                pNode = pL2N0de;

                                                pL2N0de = pL2N0de->pNext;

                                }

                                 else

                                {

                                                pNode = pL1Node;

                                                pL1Node = pL1Node->pNext;

                                }

                                pTailNode->pNext = pNode;

                                pTailNode = pTailNode->pNext;

                }

                 if (pL1Node == NULL )

                {

                                pTailNode->pNext = pL2N0de;

                }

                 else

                {

                                pTailNode->pNext = pL1Node;

                }

                 return pNewHead;

}


void Print(PSListNode pHead)

{

                 PSListNode pCurNode = pHead ;

                 while (pCurNode)

                {

                                printf( "%d->", pCurNode->data);

                                pCurNode = pCurNode->pNext;

                }

                printf( "NULL\n");

}


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

湖南省| 黎平县| 武乡县| 桑植县| 监利县| 武隆县| 怀远县| 大埔县| 微山县| 桐乡市| 萨嘎县| 敦化市| 汽车| 无棣县| 民和| 天门市| 漾濞| 托克托县| 新蔡县| 阳朔县| 女性| 额敏县| 玛曲县| 黄大仙区| 孙吴县| 泗阳县| 新民市| 九江市| 集贤县| 绥棱县| 仲巴县| 弋阳县| 多伦县| 广元市| 寻乌县| 霍城县| 龙海市| 长海县| 宜阳县| 屏东县| 依兰县|