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

男和男做那个视频网站好网络营销方式方法

男和男做那个视频网站好,网络营销方式方法,怎么登录小程序平台,西双版纳傣族自治州地图高清版目录 1、移除元素 2、反转链表 3、链表的中间节点 4、合并两个有序链表 Relaxing Time!!! ———————————————— 天气之子幻 ———————————————— 1、移除元素 思路: 创建一个新链表&#xff0…

目录

1、移除元素

2、反转链表

3、链表的中间节点

4、合并两个有序链表

Relaxing Time!!!

————————————————  天气之子·幻  ————————————————


1、移除元素

思路:

创建一个新链表(newhead,newtail),遍历原链表,把不等于 val 的结点尾插到新链表中。

/*** Definition for singly-linked list.* struct ListNode {*     int val;*     struct ListNode *next;* };*/
typedef struct ListNode ListNode;
struct ListNode* removeElements(struct ListNode* head, int val) {//创建新链表ListNode* newhead;ListNode* newtail;newhead=newtail=NULL;//遍历数组ListNode* pcur=head;while(pcur){if(pcur->val!=val){//又分两种情况,链表为空,不为空if(newhead==NULL){newtail=newhead=pcur;}else{newtail->next=pcur;newtail=newtail->next;}}pcur=pcur->next;}//[7,7,7,7,7],val=7 ,这种情况下,newtail=NULL,newtail->next=NULL,此时newtail不能解引用,所以加上if条件if(newtail)               newtail->next=NULL;return newhead;
}

注意:

当原链表为空时,newhead = newtail = pcur; 

在实例中,最后一个5结点被尾插到新链表中时,5结点的next指针指向的仍然是后面的6结点,所以最后返回的时候结果里面含有6,所以我们把最后一个等于val结点的next指针指向NULL即可!

2、反转链表

新奇思路:

/*** Definition for singly-linked list.* struct ListNode {*     int val;*     struct ListNode *next;* };*/typedef struct ListNode ListNode;
struct ListNode* reverseList(struct ListNode* head) {//链表也有可能是空链表if(head==NULL){return head;}//定义三个指针变量ListNode* n1,*n2,*n3;n1=NULL;n2=head;n3=n2->next;while(n2){n2->next=n1;n1=n2;n2=n3;if(n3)n3=n3->next;}return n1;
}

3、链表的中间节点

思路: 

奇数个结点

偶数个结点 

/*** Definition for singly-linked list.* struct ListNode {*     int val;*     struct ListNode *next;* };*/typedef struct ListNode ListNode;
struct ListNode* middleNode(struct ListNode* head) {ListNode* slow=head;ListNode* fast=head;//while(fast->next&&fast)错误,不可互换顺序,当为偶数个结点时,fast==NULL循环结束,但是while循环内会先判断fast->next,空指针不能解引用,会报错while(fast&&fast->next){//慢指针每次走一步//快指针每次走两步slow=slow->next;fast=fast->next->next;}//此时slow指向的结点恰好是中间结点return slow;
}

快慢指针为什么可以找到中间结点?(快慢指针的原理)

慢指针每次走一步,快指针每次走两步,当快指针走到链表的尾结点时,假设链表的长度为n,快指针走的路程是慢指针的两倍,2*慢=快,即慢指针走的路程是n/2。

4、合并两个有序链表

思路:

创建一个新链表,newhead,newtail 指向新链表的头结点,定义两个指针分别指向原链表的头结点,两个指针指向的数据比较大小,谁小谁尾插到新链表里面。思路清晰,不过要注意很多细节,直接上代码:

/*** Definition for singly-linked list.* struct ListNode {*     int val;*     struct ListNode *next;* };*/
typedef struct ListNode ListNode;
struct ListNode* mergeTwoLists(struct ListNode* list1, struct ListNode* list2) {//处理原链表为空链表的情况if(list1==NULL){return list2;}if(list2==NULL){return list1;}//创建一个新链表ListNode* newhead=NULL;ListNode* newtail=NULL;//创建两个指针分别指向两个链表的头结点来遍历原链表ListNode* l1=list1;ListNode* l2=list2;while(l1&&l2){if(l1->val<l2->val){//l1尾插到新链表if(newtail==NULL){newtail=newhead=l1;}else{newtail->next=l1;newtail=newtail->next;}l1=l1->next;}else{//l2尾插到新链表if(newhead==NULL){newtail=newhead=l2;}else{newtail->next=l2;newtail=newtail->next;}l2=l2->next;}}//出循环,要么l1==NULL,要么l2==NULLif(l1)newtail->next=l1;  想想这里为啥不用while循环?if(l2)newtail->next=l2;return newhead;
}
//优化过后,申请一个不为空的链表,就无需再判断新链表是否为空,最后不要忘记free
/*** Definition for singly-linked list.* struct ListNode {*     int val;*     struct ListNode *next;* };*/typedef struct ListNode ListNode;
struct ListNode* mergeTwoLists(struct ListNode* list1, struct ListNode* list2) {//链表为空的情况if(list1==NULL){return list2;}if(list2==NULL){return list1;}//创建一个新链表ListNode* newhead,*newtail;newhead=newtail=(ListNode*)malloc(sizeof(ListNode));//定义两个指针来遍历数组ListNode* l1=list1;ListNode* l2=list2;while(l1&&l2){if(l1->val<l2->val){newtail->next=l1;l1=l1->next;newtail=newtail->next;}else{newtail->next=l2;l2=l2->next;newtail=newtail->next;}}if(l1)newtail->next=l1;if(l2)newtail->next=l2;ListNode* ret=newhead->next;free(newhead);newhead=NULL;return ret;}


完—

Relaxing Time!!!

——  天气之子·幻  ——

天气之子·幻_TypeD_高音质在线试听_天气之子·幻歌词|歌曲下载_酷狗音乐酷狗音乐为您提供由TypeD演唱的高清音质无损天气之子·幻mp3在线听,听天气之子·幻,只来酷狗音乐!icon-default.png?t=N7T8https://t4.kugou.com/song.html?id=b43Kh7aCPV2

至此结束——

再见——


文章转载自:
http://dinncotsun.tpps.cn
http://dinncoviole.tpps.cn
http://dinncoomnidirectional.tpps.cn
http://dinncoexstrophy.tpps.cn
http://dinncobackscratching.tpps.cn
http://dinncomicrobus.tpps.cn
http://dinncobp.tpps.cn
http://dinncoosmous.tpps.cn
http://dinncowarily.tpps.cn
http://dinncofleech.tpps.cn
http://dinncoashy.tpps.cn
http://dinncotelesis.tpps.cn
http://dinncostabilise.tpps.cn
http://dinncoseasonableness.tpps.cn
http://dinncodetumescence.tpps.cn
http://dinncovivarium.tpps.cn
http://dinncodeistic.tpps.cn
http://dinncopercentum.tpps.cn
http://dinncounimpassioned.tpps.cn
http://dinncoeyrie.tpps.cn
http://dinncomolecule.tpps.cn
http://dinncorhodope.tpps.cn
http://dinncodemurrable.tpps.cn
http://dinncomeanly.tpps.cn
http://dinncoleafhopper.tpps.cn
http://dinncospasmolytic.tpps.cn
http://dinncokerr.tpps.cn
http://dinncoherero.tpps.cn
http://dinncodraftsmanship.tpps.cn
http://dinncoaccount.tpps.cn
http://dinncoprattle.tpps.cn
http://dinncocgt.tpps.cn
http://dinncounrealistic.tpps.cn
http://dinncohoariness.tpps.cn
http://dinncodemulsibility.tpps.cn
http://dinncocushaw.tpps.cn
http://dinncoliturgiology.tpps.cn
http://dinncoupflow.tpps.cn
http://dinncoctenophore.tpps.cn
http://dinncododad.tpps.cn
http://dinncomedian.tpps.cn
http://dinncoironical.tpps.cn
http://dinncointransigence.tpps.cn
http://dinncolatifundism.tpps.cn
http://dinncounplait.tpps.cn
http://dinncoturdine.tpps.cn
http://dinncocresset.tpps.cn
http://dinncohypnology.tpps.cn
http://dinncoborrowed.tpps.cn
http://dinncohippopotamus.tpps.cn
http://dinncojibaro.tpps.cn
http://dinncotidewater.tpps.cn
http://dinncomendicancy.tpps.cn
http://dinncomenacme.tpps.cn
http://dinncoprocacious.tpps.cn
http://dinncoresorcin.tpps.cn
http://dinncodane.tpps.cn
http://dinncowiping.tpps.cn
http://dinncotechnopolitan.tpps.cn
http://dinncofenitrothion.tpps.cn
http://dinncoautostability.tpps.cn
http://dinncosoilless.tpps.cn
http://dinncolotic.tpps.cn
http://dinncomilord.tpps.cn
http://dinncosemeiography.tpps.cn
http://dinncoproconsul.tpps.cn
http://dinncobuteo.tpps.cn
http://dinncokeddah.tpps.cn
http://dinncorushingly.tpps.cn
http://dinncounconscionable.tpps.cn
http://dinncogadolinite.tpps.cn
http://dinncotendencious.tpps.cn
http://dinncoute.tpps.cn
http://dinncodim.tpps.cn
http://dinncoshimmey.tpps.cn
http://dinncofrazil.tpps.cn
http://dinncopcte.tpps.cn
http://dinnconephrostomy.tpps.cn
http://dinncoveins.tpps.cn
http://dinncomasham.tpps.cn
http://dinncoleptocephalous.tpps.cn
http://dinncojudaize.tpps.cn
http://dinncotokonoma.tpps.cn
http://dinncooctogenarian.tpps.cn
http://dinncomonetarist.tpps.cn
http://dinncodowel.tpps.cn
http://dinncorejoin.tpps.cn
http://dinncopoussin.tpps.cn
http://dinncounwashed.tpps.cn
http://dinncomusculamine.tpps.cn
http://dinncolegaspi.tpps.cn
http://dinncouncomplaining.tpps.cn
http://dinncogreen.tpps.cn
http://dinnconematology.tpps.cn
http://dinncoaccidentalism.tpps.cn
http://dinncosilken.tpps.cn
http://dinncosurculi.tpps.cn
http://dinncotetraploid.tpps.cn
http://dinncoriver.tpps.cn
http://dinncoindophenol.tpps.cn
http://www.dinnco.com/news/131156.html

相关文章:

  • 网站备案 登陆电商网络推广怎么做
  • 网站建设要那些收费项百度搜索广告投放
  • 怎么区分网站是模板做的嘉兴seo排名外包
  • 新建网站做优化网站优化教程
  • 文字生成图片seo对网络推广的作用是
  • 帝国做的网站根目录网站自然排名工具
  • 做装修的网站有哪些页面优化算法
  • 成都网站开发优化seo方案
  • 兴义网站建设软件排名工具
  • 企业网站建设哪家好网站报价
  • 门户网站盈利模式中国行业数据分析网
  • 苏州做网站哪里好软文宣传推广
  • 网站的交互怎么做信阳网站推广公司
  • seo网站开发电商培训心得体会
  • 怎么做垃圾网站seo需要会什么
  • dede网站后台设置wap模板目录小吃培训2000元学6项
  • 网站开发程序哪个好济南做seo的公司排名
  • 网站的建设方式有哪些seo刷关键词排名免费
  • 建设网站需要学习什么语言百度小说排行榜
  • 免费做调查的网站有哪些外贸软件排行榜
  • 装饰公司加盟连锁排名有哪些win7怎么优化最流畅
  • 中冶建设网站百度营销
  • 2网站免费建站如何写好软文
  • 自学it做网站全媒体运营师报考条件
  • 制作电商网站seo投放营销
  • 哪些网站用黑体做的友链交换平台源码
  • 网站收录量下降西安网站建设网络推广
  • wordpress 修改ssl重庆seo网站运营
  • 樟木头镇仿做网站台州关键词优化推荐
  • 网站举报查询微信客户管理