合并两个已序单链表-创新互联-成都创新互联网站建设

关于创新互联

多方位宣传企业产品与服务 突出企业形象

公司简介 公司的服务 荣誉资质 新闻动态 联系我们

合并两个已序单链表-创新互联

// 合并两个已序单链表

创新互联-专业网站定制、快速模板网站建设、高性价比望城网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式望城网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖望城地区。费用合理售后完善,10多年实体公司更值得信赖。

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");

}

创新互联www.cdcxhl.cn,专业提供香港、美国云服务器,动态BGP最优骨干路由自动选择,持续稳定高效的网络助力业务部署。公司持有工信部办法的idc、isp许可证, 机房独有T级流量清洗系统配攻击溯源,准确进行流量调度,确保服务器高可用性。佳节活动现已开启,新人活动云服务器买多久送多久。


网站栏目:合并两个已序单链表-创新互联
网页URL:http://kswsj.cn/article/pseoh.html

其他资讯