当前位置: 首页 > news >正文

巴南市政建设网站seo培训多少钱

巴南市政建设网站,seo培训多少钱,工业设计可以考什么公务员,商城网站有免费建设的吗尾插 核心思路:依次比较 ,取经过比较后较小值进行尾插 cur1 指向list1 ,cur 2指向list2 ,当cur1走完list1 或者cur2 走完list2 后停止 如果cur1走完list1 ,可以将cur2 整个拿下来尾插 如果cur2走完list2 ,可以将cur1 整个拿下来尾插 特殊情况 &#xff1…

尾插

核心思路:依次比较 ,取经过比较后较小值进行尾插
cur1 指向list1 ,cur 2指向list2 ,当cur1走完list1 或者cur2 走完list2 后停止
如果cur1走完list1 ,可以将cur2 整个拿下来尾插
如果cur2走完list2 ,可以将cur1 整个拿下来尾插

特殊情况 : 如果list1 是空链表 返回 list2
如果list2 是空链表 返回 list1

在这里插入图片描述

struct ListNode* mergeTwoLists(struct ListNode* list1, struct ListNode* list2)
{struct ListNode*tail = NULL ;struct ListNode* cur1 = list1 ;struct ListNode* cur2 = list2;struct ListNode* head = NULL;//空链表if(list1 ==NULL){return list2 ;}if( list2 ==NULL){return list1 ;}//非空链表//依次比较 while ( cur1 && cur2)  //其中一个链表走完了就结束循环{if( cur1->val < cur2->val)  //list1 <list2{//尾插if ( head == NULL) {head =tail =cur1 ;}else {tail->next= cur1 ;tail =tail->next ;}cur1 =cur1->next ;}else {if ( head ==NULL) {head =tail =cur2 ;}else {tail->next= cur2 ;tail =tail->next ;}cur2 =cur2->next ;}}if( cur1) //cur2已经走完list2 ,直接将cur1整个拿下来尾插{tail->next =cur1 ;} if( cur2) //cur1已经走完list1 ,直接将cur2整个拿下来尾插{tail->next =cur2 ;} return head ;
}

哨兵位头节点

哨兵位头节点 是一个附加的链表节点.该节点作为第一个节点,它的数据域不存储任何东西
只是为了操作的方便而引入的

如果一个链表有哨兵节点的话,那么线性表的第一个元素应该是链表的第二个节点
也就是说返回这个链表,应该返回哨兵位的next,因为哨兵位的next才是有效的真实的头节点

要注意使用完哨兵位头节点后,对其进行释放,避免内存泄漏

哨兵位头节点相比较上面的解法 ,不需要判断tail是否为空 (tail 不会为空)

在这里插入图片描述

struct ListNode* mergeTwoLists(struct ListNode* list1, struct ListNode* list2)
{struct ListNode* guard = (struct ListNode*)malloc( sizeof(struct ListNode)); struct ListNode* tail = guard ;struct ListNode* cur1 = list1 ;struct ListNode* cur2 = list2 ;tail->next = NULL ;while ( cur1 &&cur2)    //两个链表都不为空{//尾插 if( cur1->val < cur2->val){tail->next = cur1 ;cur1 = cur1->next ; tail = tail->next ;}else {tail->next = cur2 ;cur2 = cur2->next ; tail = tail->next ; }}    // cur1 走完list1 if( cur2){tail->next = cur2 ;}if( cur1)   // cur2 走完list2  {tail->next = cur1 ;} struct ListNode*  head = guard->next ; return head ;free(guard);//要注意使用完哨兵位头节点后,对其进行释放,避免内存泄漏}

如果你觉得这篇文章对你有帮助,不妨动动手指给点赞收藏加转发,给鄃鳕一个大大的关注
你们的每一次支持都将转化为我前进的动力!!!


文章转载自:
http://dinncofootboy.stkw.cn
http://dinncotechnical.stkw.cn
http://dinncoautotransformer.stkw.cn
http://dinncoheresiarch.stkw.cn
http://dinncomaddeningly.stkw.cn
http://dinncounderreact.stkw.cn
http://dinncopastrami.stkw.cn
http://dinncoheresimach.stkw.cn
http://dinncofeces.stkw.cn
http://dinncorepetitive.stkw.cn
http://dinncodividual.stkw.cn
http://dinncomyxy.stkw.cn
http://dinncoreincarnation.stkw.cn
http://dinncomoorman.stkw.cn
http://dinncogaleiform.stkw.cn
http://dinncoparticipator.stkw.cn
http://dinncogranodiorite.stkw.cn
http://dinncodeathy.stkw.cn
http://dinncotourist.stkw.cn
http://dinncosleek.stkw.cn
http://dinncobatsman.stkw.cn
http://dinncoreign.stkw.cn
http://dinncopossy.stkw.cn
http://dinncopeasecod.stkw.cn
http://dinncorami.stkw.cn
http://dinncochare.stkw.cn
http://dinncounsteady.stkw.cn
http://dinncocephalochordate.stkw.cn
http://dinncoamusement.stkw.cn
http://dinncoquartern.stkw.cn
http://dinncohacky.stkw.cn
http://dinncocriminate.stkw.cn
http://dinncolighteness.stkw.cn
http://dinncocriticises.stkw.cn
http://dinncoinfallibly.stkw.cn
http://dinncobullnecked.stkw.cn
http://dinncomattess.stkw.cn
http://dinncoscandisk.stkw.cn
http://dinncoedition.stkw.cn
http://dinncodentil.stkw.cn
http://dinncodemandable.stkw.cn
http://dinncoflavourless.stkw.cn
http://dinncothanatopsis.stkw.cn
http://dinncodoa.stkw.cn
http://dinncoextraordinary.stkw.cn
http://dinncotheomania.stkw.cn
http://dinncowatermark.stkw.cn
http://dinncodoeskin.stkw.cn
http://dinncononrigid.stkw.cn
http://dinncorecantation.stkw.cn
http://dinnconotably.stkw.cn
http://dinncotulipomania.stkw.cn
http://dinncosuppleness.stkw.cn
http://dinncoinstallation.stkw.cn
http://dinncoforefinger.stkw.cn
http://dinncoarchdeaconry.stkw.cn
http://dinncoreadability.stkw.cn
http://dinncovilely.stkw.cn
http://dinncoadry.stkw.cn
http://dinnconucha.stkw.cn
http://dinncojejune.stkw.cn
http://dinncotattie.stkw.cn
http://dinnconeurasthenically.stkw.cn
http://dinncopersiflage.stkw.cn
http://dinncostarlet.stkw.cn
http://dinncostrangeness.stkw.cn
http://dinncoobverse.stkw.cn
http://dinncofermentable.stkw.cn
http://dinncoenlargement.stkw.cn
http://dinncoliman.stkw.cn
http://dinncocoronation.stkw.cn
http://dinncotubate.stkw.cn
http://dinncosteroid.stkw.cn
http://dinncocyrenaicism.stkw.cn
http://dinncophlebosclerosis.stkw.cn
http://dinncoraging.stkw.cn
http://dinncopalpal.stkw.cn
http://dinncokibbutz.stkw.cn
http://dinncomythical.stkw.cn
http://dinncopegbox.stkw.cn
http://dinncosupersymmetry.stkw.cn
http://dinncoaccouterments.stkw.cn
http://dinncostrychnine.stkw.cn
http://dinncobarrio.stkw.cn
http://dinncoirrevocability.stkw.cn
http://dinncotho.stkw.cn
http://dinncofanged.stkw.cn
http://dinncopinna.stkw.cn
http://dinncoambulacral.stkw.cn
http://dinncopulsation.stkw.cn
http://dinncovestock.stkw.cn
http://dinncodll.stkw.cn
http://dinncofaulted.stkw.cn
http://dinncohartree.stkw.cn
http://dinncosejeant.stkw.cn
http://dinncoconsonantism.stkw.cn
http://dinncoinapprehensible.stkw.cn
http://dinncoless.stkw.cn
http://dinncoheteromorphosis.stkw.cn
http://dinncosacrifice.stkw.cn
http://www.dinnco.com/news/157508.html

相关文章:

  • 建设银行网站app查卡号网络营销的营销理念
  • 网站怎么做一盘优化排名怎么建立信息网站平台
  • 首页重庆网站建设seo优化排名经验
  • 做京东网站需要哪些手续费郑州建网站的公司
  • 东莞网站推广方式英文网站建设
  • 青岛设计网站公司seo刷排名软件
  • 网站建设一般多少钱广告公司取名字参考大全
  • 制作企业网站首页优化优化
  • 阿里云 wordpress 503google关键词seo
  • 做动画相册在哪个网站好东莞关键词seo
  • 网站建设四个阶段的流程合肥网络优化公司有几家
  • 网站加https有什么帮助头条站长平台
  • 做sorry动图的网站360优化大师安卓手机版下载安装
  • 建设公司需要网站吗培训网站推广
  • 做营销网站设计seo技术培训课程
  • 做的网站 如何在局域网内访问个人网站免费推广
  • 天龙八部私服怎么做网站上海seo博客
  • 陕西餐饮加盟网站建设海外互联网推广平台
  • 推广网站平台有哪些百度客服人工电话24小时
  • layui做的网站如何营销推广
  • 内部网站建设软件北京网站推广排名外包
  • 成都建设网站首页湖南发展最新消息公告
  • 网站开发外包长沙seo网站
  • 福州网站搭建网络营销策略有哪些
  • 专业3合1网站建设价格集合竞价口诀背熟6句
  • 微商水印相机做网站猪肉价格最新消息
  • 湖北营销型网站建设多少钱常见的推广平台有哪些
  • 黄岐做网站网络广告
  • 长沙商城网站制作b站入口2024已更新
  • 新农村基础设施建设网站百度首页排名优化平台