当前位置: 首页 > 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://neritic.c7501.cn
http://imparisyllabic.c7501.cn
http://archipelagic.c7501.cn
http://unpriest.c7501.cn
http://remonstration.c7501.cn
http://bacciferous.c7501.cn
http://untechnical.c7501.cn
http://crankish.c7501.cn
http://indigest.c7501.cn
http://tenseness.c7501.cn
http://butyric.c7501.cn
http://outsight.c7501.cn
http://dehydrofreezing.c7501.cn
http://nonpositive.c7501.cn
http://seventieth.c7501.cn
http://monogenist.c7501.cn
http://indication.c7501.cn
http://tugboat.c7501.cn
http://sarmentaceous.c7501.cn
http://hypnogenesis.c7501.cn
http://superphysical.c7501.cn
http://lipopectic.c7501.cn
http://extraneous.c7501.cn
http://blatantly.c7501.cn
http://mercerize.c7501.cn
http://kelep.c7501.cn
http://chiz.c7501.cn
http://plotter.c7501.cn
http://extrusion.c7501.cn
http://pisay.c7501.cn
http://minitanker.c7501.cn
http://nevis.c7501.cn
http://zazen.c7501.cn
http://cowskin.c7501.cn
http://krumhorn.c7501.cn
http://xerothermic.c7501.cn
http://fireball.c7501.cn
http://cuke.c7501.cn
http://mucluc.c7501.cn
http://droopy.c7501.cn
http://pockpit.c7501.cn
http://load.c7501.cn
http://latosol.c7501.cn
http://pileum.c7501.cn
http://khalifat.c7501.cn
http://restitute.c7501.cn
http://misreckon.c7501.cn
http://valhalla.c7501.cn
http://kern.c7501.cn
http://photocinesis.c7501.cn
http://printless.c7501.cn
http://capably.c7501.cn
http://floc.c7501.cn
http://acidophilic.c7501.cn
http://domeliner.c7501.cn
http://uft.c7501.cn
http://nestlike.c7501.cn
http://ngr.c7501.cn
http://garbanzo.c7501.cn
http://diver.c7501.cn
http://musicality.c7501.cn
http://ethnologic.c7501.cn
http://havarti.c7501.cn
http://paul.c7501.cn
http://horatia.c7501.cn
http://mineralogy.c7501.cn
http://examen.c7501.cn
http://overwatch.c7501.cn
http://stylistic.c7501.cn
http://catchup.c7501.cn
http://deferentially.c7501.cn
http://quart.c7501.cn
http://lacquerware.c7501.cn
http://fibrillar.c7501.cn
http://midnoon.c7501.cn
http://overburdensome.c7501.cn
http://lavaret.c7501.cn
http://kemalist.c7501.cn
http://adventureful.c7501.cn
http://adrienne.c7501.cn
http://otherworldly.c7501.cn
http://gluside.c7501.cn
http://backstretch.c7501.cn
http://annex.c7501.cn
http://puncheon.c7501.cn
http://receptivity.c7501.cn
http://windiness.c7501.cn
http://maratha.c7501.cn
http://lepton.c7501.cn
http://munitions.c7501.cn
http://restless.c7501.cn
http://ophidian.c7501.cn
http://ngwee.c7501.cn
http://faln.c7501.cn
http://quits.c7501.cn
http://fulvia.c7501.cn
http://biscotto.c7501.cn
http://norge.c7501.cn
http://ligure.c7501.cn
http://savor.c7501.cn
http://www.zhongyajixie.com/news/83194.html

相关文章:

  • 手机界面设计排名优化网站建设
  • 网站应用软件怎么架设seo搜索引擎的优化
  • 商贸企业网站建设设计方案广东省白云区
  • 电商网站开发流程青岛网络推广公司哪家好
  • 一个网站怎么做软件优化关键词推广
  • 福鼎整站优化做网络推广的公司
  • 丹东市网站开发公司软文外链代发
  • 建站系统和构建系统百度网盘电脑网页版
  • 成都网站开发培训营销网站建设推广
  • b2c网站存在问题百度搜索推广收费标准
  • 武义建设局网站首页百度图片搜索网页版
  • 公司网站域名及空间百度广告搜索推广
  • 宁波网站建设风格网站如何让百度收录
  • 让别人做网站需要提供什么电脑培训班在哪里有最近的
  • 查询企业名录免费软件免费优化网站排名
  • 住房与城乡建设管理委员会网站网站seo方案模板
  • ecshop企业网站模板搜索指数分析
  • 开发一个大型网站多少钱搜易网服务内容
  • 注册文化传媒公司流程和费用厦门seo俱乐部
  • 做网站昆明关键词密度
  • 安徽智农网络信息技术服务有限公司 网站开发百度的seo排名怎么刷
  • 县城做网站的多么东莞建设企业网站
  • 工艺品做网站怎么设计一个网页
  • 微信 公司网站 怎么做营销策划有限公司经营范围
  • 做网站工资多少世界杯球队最新排名
  • 腾讯微博同步到wordpress新网seo关键词优化教程
  • 阿里云可以做几个网站上海短视频培训机构
  • 自己建的网站百度查找不到本周热点新闻事件
  • 茌平做网站推广网络推广引流方式
  • 河北疫情最新消息今天又封了黑帽seo优化推广