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

购物网站免费模板舆情信息在哪里找

购物网站免费模板,舆情信息在哪里找,效果图制作合同范本,网络营销推广方法研究文章目录 前言一、链表分割二、环形链表I三、环形链表II四、链表的回文结构五、随机链表的复制 前言 一、链表分割 牛客网CM11:链表分割- - -点击此处传送 题解: 思路图: 代码: 二、环形链表I 力扣141:环形链表…

文章目录

  • 前言
  • 一、链表分割
  • 二、环形链表I
  • 三、环形链表II
  • 四、链表的回文结构
  • 五、随机链表的复制


前言

一、链表分割

牛客网CM11:链表分割- - -点击此处传送
在这里插入图片描述
题解:
思路图:
在这里插入图片描述
代码:
在这里插入图片描述

二、环形链表I

力扣141:环形链表- - -点击此处传送
在这里插入图片描述
思路图:
在这里插入图片描述
扩展问题:
在这里插入图片描述

代码:

bool hasCycle(struct ListNode *head) {struct ListNode*fast=head,*slow=head;while(fast && fast->next){//slow走一步slow=slow->next;//fast走两步fast=fast->next->next;//若相等(相遇)则有环,返回true并退出程序if(fast==slow){return true;}}//否则无环return false;
}

三、环形链表II

力扣142:环形链表II- - -点击此处传送
在这里插入图片描述
题解:
思路图:
在这里插入图片描述
代码:

struct ListNode *detectCycle(struct ListNode *head) {struct ListNode*fast=head;struct ListNode*slow=head;while(fast && fast->next){slow=slow->next;fast=fast->next->next;if(fast==slow){struct ListNode*meet=slow;while(head != meet){head=head->next;meet=meet->next;}return meet;}}return NULL;
}

四、链表的回文结构

牛客网OR36:链表的回文结构- - -点击此处传送
在这里插入图片描述
思路图:
在这里插入图片描述

代码:

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;}struct ListNode*middleNode(struct ListNode*head){struct ListNode*slow=head;struct ListNode*fast=head;while(fast && fast->next){slow=slow->next;fast=fast->next->next;}return slow;}bool chkPalindrome(ListNode* head) {struct ListNode*mid=middleNode(head);struct ListNode*rhead=reverseList(mid);while(head && rhead){if(head->val != rhead->val)return false;head=head->next;rhead=rhead->next;}return true;}

五、随机链表的复制

力扣138:随机链表的复制- - -点击此处传送
在这里插入图片描述
思路图:
在这里插入图片描述
代码:

struct Node* copyRandomList(struct Node* head) 
{struct Node*cur=head;while(cur){struct Node*copy=(struct Node*)malloc(sizeof(struct Node));copy->val=cur->val;copy->next=cur->next;cur->next=copy;cur=copy->next;} cur=head;while(cur){struct Node*copy=cur->next;if(cur->random==NULL){copy->random=NULL;}else{copy->random=cur->random->next;}cur=copy->next;}cur=head;struct Node*newhead=NULL;struct Node*tail=NULL;while(cur){struct Node*copy=cur->next;struct Node*next=copy->next;if(tail==NULL){newhead=tail=copy;}else{tail->next=copy;tail=tail->next;}cur->next=next;cur=next;}return newhead;
}
http://www.hkea.cn/news/926737/

相关文章:

  • 网站换程序301seo优化按天扣费
  • html5 网站自适应长尾关键词挖掘爱站工具
  • 网站设计公司(信科网络)潍坊网站定制模板建站
  • 番禺网站开发报价百度竞价排名软件
  • 做企业网站接单seo网站优化技术
  • 建设网站行业云网络推广理实一体化软件
  • 如何用自己公司网站做邮箱关键字是什么意思
  • 古典网站建设欣赏马鞍山网站seo
  • 商城网站建设报价方案免费建网站软件下载
  • 中国做美国酒店的网站好竞价托管收费标准
  • 网站开发与设计静态网页源代码站长之家app下载
  • 松原做网站app运营推广是干什么
  • 做简单的网站链接2024新闻热点摘抄
  • 百度网站站长环球网疫情最新
  • 颍上做网站西安seo网站关键词优化
  • 有没有兼职做设计的网站吗知名网络软文推广平台
  • 数据百度做网站好用吗米拓建站
  • 网站维护运营怎么做搜索引擎优化通常要注意的问题有
  • 圆梦科技专业网站建设恶意点击软件有哪些
  • 如何做vip电影解析网站竞价恶意点击器
  • 开发简单小程序公司深圳网站优化哪家好
  • 网站开发劣势搜索引擎排名优化
  • 桂林网站优化公司企业网络营销顾问
  • 上海外贸出口代理公司排名搜索引擎优化的主要工作有
  • 一般做企业网站需要什么资料广告咨询
  • 广州网站建设兼职网站为什么要做seo
  • 中企动力官网 网站怎么在平台上做推广
  • 教育培训网站建设方案广告宣传费用一般多少
  • 计算机网站设计论文营销排名seo
  • 源码资源国内专业seo公司