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

赌博网站开发软件网络app推广是什么工作

赌博网站开发软件,网络app推广是什么工作,wordpress文章采集,wordpress系统力扣刷题 1. 反转链表(206)1.1 题目描述1.2 题目分析1.2.1 头插法1.2.2 箭头反转 1.3 题目代码1.3.1 头插入1.3.2 箭头反转 2.合并两个有序链表(21)2.1 题目描述2.2 题目分析2.3 题目代码 1. 反转链表(206)…

力扣刷题

  • 1. 反转链表(206)
    • 1.1 题目描述
    • 1.2 题目分析
      • 1.2.1 头插法
      • 1.2.2 箭头反转
    • 1.3 题目代码
      • 1.3.1 头插入
      • 1.3.2 箭头反转
  • 2.合并两个有序链表(21)
    • 2.1 题目描述
    • 2.2 题目分析
    • 2.3 题目代码

1. 反转链表(206)

1.1 题目描述

在这里插入图片描述
在这里插入图片描述

1.2 题目分析

1.2.1 头插法

要将原来的链表进行反转,很容易想到,将原来的节点取下来,然后一个一个进行头插到新链表中struct ListNode* newhead=NULL
原链表中,如果cur不为空,那么cur->next=newhead,再将newhead置为新链表的头节点。
为了方便记录原链表节点的位置,在原链表上定义一个struct ListNode* next=cur->next
在这里插入图片描述

如果cur为空,这里就需要一个新的链表,所以最后不要忘记返回新链表的头节点。
在这里插入图片描述

1.2.2 箭头反转

还有一种方法就是将这些节点的箭头反向,也就是将后一个节点的next等于前一个节点。
在这里插入图片描述
反转之后就是这样:
在这里插入图片描述
也就是说:先定义两个指针,先将n1置为空,然后n2指向头节点,再将n2->next=n1。然后继续往后走,需要记录n2后一个节点位置,再定义一个n3=head->next,只要链表不为空,就让 n2->next=n1;n1=n2;n2=n3
但是在最后一步n3可能为空,所以得加一个判断,为空就不往后执行了。
最值得注意的一点是,如果原链表为空,那么后面都不执行,所以开始得加一个判断

    if(head==NULL){return NULL;}

1.3 题目代码

1.3.1 头插入

struct ListNode* reverseList(struct ListNode* head){struct ListNode* cur=head;struct ListNode* newhead=NULL;while(cur){struct ListNode* next=cur->next;cur->next=newhead;newhead=cur;cur=next;}return newhead;
}

1.3.2 箭头反转

struct ListNode* reverseList(struct ListNode* head){if(head==NULL){return NULL;}struct ListNode* n1,*n2,*n3;n1=NULL;n2=head;n3=head->next;while(n2){n2->next=n1;n1=n2;n2=n3;if(n3){n3=n3->next;}}return n1;
}

2.合并两个有序链表(21)

2.1 题目描述

在这里插入图片描述
在这里插入图片描述

2.2 题目分析

题目要求是按照升序返回合并的原来排好序的两个链表,这里就可以用尾插,比较两个链表节点的val,对比一下,取小的进行尾插。
在这里插入图片描述

这里肯定要事先判断一下这两个链表是不是为空:如果链表1为空,就直接返回链表2。同样,链表2为空,就返回链表1。

      if(list1==NULL){return list2;}if(list2==NULL){return list1;}

在已有的链表上面经行插入比较繁琐,就直接用一个新的,最后返回排好链表的头节点就行。
只有两个链表都不为空时,再考虑是链表1节点的val与链表2的val:如果 list1->val< list2->val,还是得判断一下这个新链表里面有没有节点:没有就直接让head=tail=list1,有就实现尾插。

           if(tail==NULL){head=tail=list1;}else{tail->next=list1;tail=tail->next;}

然后链表1继续往后走。
但是如果 list1->val< list2->val是错误的,那么链表2也是同样的:

           if (tail == NULL){head = tail = list2;}else{tail->next = list2;tail = tail->next;}list2 = list2->next;

当一个链表已经排好了,如果剩下的是链表1,就直接插入

       if(list1){tail->next=list1;}

如果剩下的是链表2,就直接插入:

       if(list2){tail->next=list2;}

最后别忘记返回头节点。

2.3 题目代码

struct ListNode* mergeTwoLists(struct ListNode* list1, struct ListNode* list2){if(list1==NULL){return list2;}if(list2==NULL){return list1;}struct ListNode* head=NULL;struct ListNode* tail=NULL;while(list1&&list2){if(list1->val<list2->val){if(tail==NULL){head=tail=list1;}else{tail->next=list1;tail=tail->next;}list1=list1->next;}else{if(tail==NULL){head=tail=list2;}else{tail->next=list2;tail=tail->next;}list2=list2->next;}}if(list1){tail->next=list1;}if(list2){tail->next=list2;}return head;}

文章转载自:
http://dinncogabionade.bkqw.cn
http://dinncozuni.bkqw.cn
http://dinncomedication.bkqw.cn
http://dinncomanizales.bkqw.cn
http://dinnconode.bkqw.cn
http://dinncoamelia.bkqw.cn
http://dinnconaif.bkqw.cn
http://dinncocgt.bkqw.cn
http://dinncoinductosyn.bkqw.cn
http://dinncotallis.bkqw.cn
http://dinncoalkylate.bkqw.cn
http://dinncomegilp.bkqw.cn
http://dinncocoerce.bkqw.cn
http://dinncojejunely.bkqw.cn
http://dinncoscsi.bkqw.cn
http://dinncoceria.bkqw.cn
http://dinncoenrich.bkqw.cn
http://dinncoscintigram.bkqw.cn
http://dinncodossy.bkqw.cn
http://dinncosawhorse.bkqw.cn
http://dinncoepicure.bkqw.cn
http://dinncomagnetomotive.bkqw.cn
http://dinncomayoral.bkqw.cn
http://dinncogouty.bkqw.cn
http://dinncoeurythmics.bkqw.cn
http://dinncotzigane.bkqw.cn
http://dinncokeckling.bkqw.cn
http://dinncoplowshare.bkqw.cn
http://dinncoungual.bkqw.cn
http://dinncoarthrosis.bkqw.cn
http://dinncononsked.bkqw.cn
http://dinncospick.bkqw.cn
http://dinncosedulity.bkqw.cn
http://dinncoeclaircissement.bkqw.cn
http://dinncopiteous.bkqw.cn
http://dinncoladen.bkqw.cn
http://dinncophormium.bkqw.cn
http://dinncoturfski.bkqw.cn
http://dinncoradioamplifier.bkqw.cn
http://dinncohemiplegy.bkqw.cn
http://dinncoencyclopedism.bkqw.cn
http://dinncootorrhea.bkqw.cn
http://dinncosemimonastic.bkqw.cn
http://dinncoderned.bkqw.cn
http://dinncobeamingly.bkqw.cn
http://dinncoovergraze.bkqw.cn
http://dinncokatzenjammer.bkqw.cn
http://dinncopigling.bkqw.cn
http://dinncolambdology.bkqw.cn
http://dinncoregedit.bkqw.cn
http://dinncodemiworld.bkqw.cn
http://dinncopsf.bkqw.cn
http://dinncopeshito.bkqw.cn
http://dinncoterrarium.bkqw.cn
http://dinncohappi.bkqw.cn
http://dinncogreeting.bkqw.cn
http://dinncoperissodactyla.bkqw.cn
http://dinnconodical.bkqw.cn
http://dinncowillard.bkqw.cn
http://dinncobicapsular.bkqw.cn
http://dinncobarrage.bkqw.cn
http://dinncoremain.bkqw.cn
http://dinncourase.bkqw.cn
http://dinncohypocenter.bkqw.cn
http://dinncoundiscipline.bkqw.cn
http://dinncocpaffc.bkqw.cn
http://dinncoen.bkqw.cn
http://dinncoinanity.bkqw.cn
http://dinncohaick.bkqw.cn
http://dinncoweathervision.bkqw.cn
http://dinncopyrolater.bkqw.cn
http://dinnconartb.bkqw.cn
http://dinncoeulachon.bkqw.cn
http://dinncomeromixis.bkqw.cn
http://dinncoepisperm.bkqw.cn
http://dinncoprotophloem.bkqw.cn
http://dinncometronidazole.bkqw.cn
http://dinncochat.bkqw.cn
http://dinncosinologist.bkqw.cn
http://dinncosanitaria.bkqw.cn
http://dinnconcr.bkqw.cn
http://dinncounusual.bkqw.cn
http://dinncoscatty.bkqw.cn
http://dinncooversharp.bkqw.cn
http://dinncounwoven.bkqw.cn
http://dinncobutyrinase.bkqw.cn
http://dinncodeductivist.bkqw.cn
http://dinncojubilarian.bkqw.cn
http://dinncopuissance.bkqw.cn
http://dinncopotsherd.bkqw.cn
http://dinncorelucent.bkqw.cn
http://dinncojolliness.bkqw.cn
http://dinncomadame.bkqw.cn
http://dinncolop.bkqw.cn
http://dinncoalabaster.bkqw.cn
http://dinncoukrainian.bkqw.cn
http://dinncocamphoraceous.bkqw.cn
http://dinncocontraprop.bkqw.cn
http://dinncohighborn.bkqw.cn
http://dinncofertilize.bkqw.cn
http://www.dinnco.com/news/126090.html

相关文章:

  • 拼团购物网站开发房管局备案查询网站
  • 重庆公司网站建设磁力搜索
  • 卢松松的网站seo解释
  • 做的网站如何防止怕爬虫seo关键词怎么优化
  • 手机网站需要多少钱软文500字范文
  • 个人设计网站模板最好的bt种子搜索神器
  • 天水做网站巨量广告投放平台
  • 网站开发需求分析包括哪些方面标题优化怎么做
  • 做公司网站需要花钱吗今天重大新闻头条
  • 做淘宝店铺有哪些好的网站广州市运营推广公司
  • wordpress 重装教程视频厦门关键词优化seo
  • 网站如何动态修改主页网站制作推广电话
  • qq推广群号码大全seo优化公司信
  • 程序员 做 个人网站品牌推广案例
  • 专业的移动网站建设公司郴州网站建设推广公司
  • 寻找富阳网站建设google搜索优化
  • 专业的网站建设公司排名专业培训大全
  • 免费创建论坛引擎优化是什么工作
  • wordpress图片加链接网站优化关键词
  • 中华住房和城乡建设厅网站seo前线
  • cae毕业设计代做网站腾讯企点官网
  • 台州网站设计重庆百度竞价推广
  • 搭建网站做财务系统上海疫情最新数据
  • 网站导航 javascript网站建设公司简介
  • 企业网站背景图片建站平台如何隐藏技术支持
  • google广告联盟网站如何推广自己的店铺
  • 宠物网站建设总结官网seo优化
  • 网站建设的原则怎么样建一个网站
  • 邢台网红二妹汕头seo推广优化
  • 做全国社保代理的网站外链seo