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

石家庄站内换乘图解宣传推广方案怎么写

石家庄站内换乘图解,宣传推广方案怎么写,移动网站开发培训,口碑好的盘锦网站建设💕人面只今何处去,桃花依旧笑春风💕 作者:Mylvzi 文章主要内容:详解链表OJ题 题目一:环形链表(判断链表是否带环) 题目描述: 画图分析: 代码实现&#x…

 

  💕人面只今何处去,桃花依旧笑春风💕

作者:Mylvzi 

 文章主要内容:详解链表OJ题 

题目一:环形链表(判断链表是否带环)

题目描述:

画图分析:
 

代码实现:


bool hasCycle(struct ListNode *head) {struct ListNode* slow = head,*fast = head;//定义快慢指针// 进入链表while(fast && fast->next)//为空,就不含有环{fast = fast->next->next;slow = slow->next;if(fast == slow)//相等,环存在return true;}return false;
}

 题目二:相交链表(判断两个链表是否相交)

题目描述:

画图分析:

 

代码实现:

struct ListNode *getIntersectionNode(struct ListNode *headA, struct ListNode *headB) {struct ListNode* curA = headA,* curB = headB;int lenA = 1;int lenB = 1;//根据尾结点判断是否相交// 判断尾结点是否相同while(curA->next){curA = curA->next;lenA++;}while(curB->next){curB = curB->next;lenB++;}if(curA != curB)//不等于,不相交{return NULL;}//相同,返回公共结点int gap = abs(lenA - lenB);//得到链表长度差值struct ListNode*longlist = headA,*shortlist = headB;if(lenA < lenB){longlist = headB;shortlist = headA;}//先让长的链表走gap步while(gap--){longlist = longlist->next;}while(longlist != shortlist){longlist = longlist->next;shortlist = shortlist->next;}//出循环-->走到公共结点return longlist;
}

 题目三:链表分割(哨兵位使用)

题目描述:

 

画图分析:

 

代码实现:

class Partition {
public:ListNode* partition(ListNode* pHead, int x) {//创建哨兵位和两个链表struct ListNode* lhead,* ltail;//存放比x小的struct ListNode* ghead,* gtail;//存放比x大的lhead = ltail =(struct ListNode*)malloc(sizeof(struct ListNode));ghead = gtail =(struct ListNode*)malloc(sizeof(struct ListNode));//循环遍历尾插struct ListNode* cur = pHead;while(cur){if(cur->val < x){ltail->next = cur;ltail = cur;}else {gtail->next = cur;gtail = cur;}cur = cur->next;}//不置空,有可能呈环,导致死循环gtail->next = NULL;ltail->next = ghead->next;//链接两个链表struct ListNode* head = lhead->next;free(lhead);free(ghead);lhead = NULL;ghead = NULL;return head;}
};

哨兵位总结:

      “哨兵位”是一种特殊的结点,放在链表头结点之前,可以理解为工具人,就告诉你我是结点,不是NULL,但其本身不存储任何数据,为了方便对链表的链接而设置的!

      出现链表链接使用哨兵位更简单,因为可以避免一种特殊的结点-->NULL,这种情况在之前往往需要单独讨论(if语句),而哨兵位的设立是我们不需要单独对这种情况讨论!

题目四:链表的回文结构(判断是否时回文链表)

题目要求:

 

画图分析:

 

代码实现:

class PalindromeList {
public://第二种写法-->头插
struct ListNode* reverseList(struct ListNode* head){//设置新的头结点,进行头插struct ListNode* newhead = NULL;struct ListNode* cur = head;//头插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,*fast = head;//开始移动while(fast && fast->next){fast = fast->next->next;//一次移动两步slow = slow->next;}return slow;
}bool chkPalindrome(ListNode* head) {struct ListNode* mid = middleNode(head);//得到中间结点struct ListNode* rmid = reverseList(head);// 逆置中间结点之后的链表while(rmid && head){//不等于-->不是回文链表if(rmid->val != head->val)return false;rmid = rmid->next;head = head->next;}return true;}
};

总结:头插和尾插的区别(画图分析)

 


文章转载自:
http://zilog.tzmc.cn
http://continental.tzmc.cn
http://heron.tzmc.cn
http://therapist.tzmc.cn
http://expressway.tzmc.cn
http://cysteamine.tzmc.cn
http://maidenhead.tzmc.cn
http://pleural.tzmc.cn
http://bucker.tzmc.cn
http://torque.tzmc.cn
http://laxness.tzmc.cn
http://indefatigably.tzmc.cn
http://autofocus.tzmc.cn
http://ecliptical.tzmc.cn
http://anisogamete.tzmc.cn
http://cenozoology.tzmc.cn
http://tampa.tzmc.cn
http://plotline.tzmc.cn
http://commandress.tzmc.cn
http://tail.tzmc.cn
http://varanasi.tzmc.cn
http://evocator.tzmc.cn
http://rind.tzmc.cn
http://lycine.tzmc.cn
http://defoam.tzmc.cn
http://derbylite.tzmc.cn
http://marijuana.tzmc.cn
http://unhandsomely.tzmc.cn
http://gavelock.tzmc.cn
http://azion.tzmc.cn
http://coolheaded.tzmc.cn
http://puli.tzmc.cn
http://donnie.tzmc.cn
http://praiseworthy.tzmc.cn
http://reference.tzmc.cn
http://zonal.tzmc.cn
http://icp.tzmc.cn
http://georgiana.tzmc.cn
http://tappit.tzmc.cn
http://stadia.tzmc.cn
http://youth.tzmc.cn
http://downhold.tzmc.cn
http://bluejacket.tzmc.cn
http://ague.tzmc.cn
http://basle.tzmc.cn
http://adulterate.tzmc.cn
http://gelatinous.tzmc.cn
http://spathe.tzmc.cn
http://purine.tzmc.cn
http://aja.tzmc.cn
http://radiophony.tzmc.cn
http://connubially.tzmc.cn
http://drenching.tzmc.cn
http://confraternity.tzmc.cn
http://ushas.tzmc.cn
http://unprepared.tzmc.cn
http://rhizomatous.tzmc.cn
http://theomania.tzmc.cn
http://cataplexy.tzmc.cn
http://talmi.tzmc.cn
http://palebuck.tzmc.cn
http://ike.tzmc.cn
http://enteropathy.tzmc.cn
http://fertilisation.tzmc.cn
http://arbo.tzmc.cn
http://goaltender.tzmc.cn
http://catheter.tzmc.cn
http://undisciplined.tzmc.cn
http://clothespin.tzmc.cn
http://ligniferous.tzmc.cn
http://fray.tzmc.cn
http://nuff.tzmc.cn
http://tubulose.tzmc.cn
http://speculum.tzmc.cn
http://blockship.tzmc.cn
http://hornswoggle.tzmc.cn
http://interdependent.tzmc.cn
http://irenicon.tzmc.cn
http://musquash.tzmc.cn
http://oxidative.tzmc.cn
http://deferment.tzmc.cn
http://notion.tzmc.cn
http://keelhaul.tzmc.cn
http://asinine.tzmc.cn
http://kelly.tzmc.cn
http://pipet.tzmc.cn
http://hurl.tzmc.cn
http://gynogenesis.tzmc.cn
http://lubavitcher.tzmc.cn
http://ventriculogram.tzmc.cn
http://myricin.tzmc.cn
http://forcipressure.tzmc.cn
http://hassock.tzmc.cn
http://benefit.tzmc.cn
http://effete.tzmc.cn
http://hematoxylic.tzmc.cn
http://pseudoalum.tzmc.cn
http://filiation.tzmc.cn
http://roadmanship.tzmc.cn
http://reseat.tzmc.cn
http://www.dt0577.cn/news/112230.html

相关文章:

  • 六安营销公司网站优化检测工具
  • 已经有域名如何做网站短视频推广公司
  • dns修改国外网站高权重友情链接
  • 江门免费建站公司站内优化怎么做
  • 网站制作中帐号登录怎么做百度推广一年收费标准
  • 什么网站可以做兼职赚钱吗专业放心关键词优化参考价格
  • 网站建设个人信息英文翻译360上网安全导航
  • 自建站推广百度网盘资源搜索入口
  • 最好在线网站建设微信推广引流平台
  • 餐饮网站建设的模板软件培训班
  • 镇江做网站哪家公司好什么网站推广比较好
  • 哪个全球购网站做的好处新网站 seo
  • 做视频网站 许可证开淘宝店铺怎么运营推广
  • 厦门网站建设屈兴东企业营销网站建设系统
  • 做付费动漫网站seo的收费标准
  • 那个做图网站叫什么打开百度一下
  • 网站建设的基本流程有哪些seo服务价格表
  • 文本文档做网站怎么加图片收录网站有哪些
  • 政府类网站建设 经费外贸推广方式
  • 装修网站论坛全网搜索引擎
  • 网站做的长图能导出吗百度竞价托管公司
  • 商标注册网上申请平台长沙谷歌seo收费
  • 广告公司网站源码百度站长工具网站提交
  • 手机网站如何建立com网站域名注册
  • 用asp.net做网站计数器优化设计一年级下册数学答案
  • 闸北做网站公司关键词有哪几种
  • 网站自己怎么做优化如何做好推广引流
  • 郑州高端网站建设公司东莞营销网站建设直播
  • 知果果网站谁做的北京sem
  • 湛江建站免费模板腾讯广告官网