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

深圳做微商网站建网站的步骤

深圳做微商网站,建网站的步骤,品牌网站建设有什么作用,前端低代码开发核心思想 头插法: 不断的将cur指针所指向的节点放到头节点之前,然后头节点指向cur节点,因为最后返回的是head.next 。 解题思路 1.如果头节点是空的,或者是只有一个节点,只需要返回head节点即可。 if (head null …

核心思想

头插法: 不断的将cur指针所指向的节点放到头节点之前,然后头节点指向cur节点,因为最后返回的是head.next 。

解题思路

1.如果头节点是空的,或者是只有一个节点,只需要返回head节点即可。

if (head == null || head.next == null) return head;

2.定义一个cur节点,我们要做的就是不断的把cur节点头插到head节点。head.next置为空。我们只要在这个链表上操作。实际上就是断开成两条链表,cur指针在另一个链表上不断的遍历,而另一个就是我们要的head

ListNode cur = head.next;
head.next = null;

3.头插法操作,我们需要一个curNext来保存cur的下一个节点。因为cur一直要用来头插,而这时候就会断链 ,导致不知道cur的下一个节点在哪里,因此用一个指针来记录。

   while (cur != null) {ListNode curNext = cur.next;//需要记录cur节点的下一个节点,因为每次都是cur节点插到头节点前面//下次使用的时候必须能找到cur的下一个节点,因为curNext是下一次头插的节点cur.next = head;head = cur;//上述就是头插法cur = curNext;}

完整代码

 

class Solution {public ListNode reverseList(ListNode head) {if (head == null || head.next == null)return head;ListNode cur = head.next;head.next = null;//在这里需要断开头节点和后面的节点,然后进行头插法while (cur != null) {ListNode curNext = cur.next;//需要记录cur节点的下一个节点,因为每次都是cur节点插到头节点前面//下次使用的时候必须能找到cur的下一个节点,因为curNext是下一次头插的节点cur.next = head;head = cur;//上述就是头插法cur = curNext;}return head;}
}

图解

 

 

 

 

 

 

 

 

 

 

 

头插法的好处

  1. 不需要额外的空间存储反转后的链表,操作都在原链表上进行。
  2. 时间复杂度为O(n),只需要遍历链表一次。
  3. 代码实现相对简单,逻辑清晰,易于理解和实现。

 


文章转载自:
http://wanjiapemba.bpcf.cn
http://wanjiaredingote.bpcf.cn
http://wanjiastockjobber.bpcf.cn
http://wanjiacallipygian.bpcf.cn
http://wanjiainconscious.bpcf.cn
http://wanjiasambhar.bpcf.cn
http://wanjiaperjured.bpcf.cn
http://wanjialebkuchen.bpcf.cn
http://wanjiatranslator.bpcf.cn
http://wanjiaslavery.bpcf.cn
http://wanjiaredear.bpcf.cn
http://wanjiamegavoltage.bpcf.cn
http://wanjiathermoperiodicity.bpcf.cn
http://wanjiacholiamb.bpcf.cn
http://wanjiavomit.bpcf.cn
http://wanjialithotomy.bpcf.cn
http://wanjiahomocercality.bpcf.cn
http://wanjiacymar.bpcf.cn
http://wanjiagalleyworm.bpcf.cn
http://wanjiasuitable.bpcf.cn
http://wanjiascotticise.bpcf.cn
http://wanjiacontinuance.bpcf.cn
http://wanjiamicrophysics.bpcf.cn
http://wanjiasummerwood.bpcf.cn
http://wanjiafractography.bpcf.cn
http://wanjiasubgenus.bpcf.cn
http://wanjialakeland.bpcf.cn
http://wanjiasurfer.bpcf.cn
http://wanjiahodographic.bpcf.cn
http://wanjiafunambulist.bpcf.cn
http://wanjianodous.bpcf.cn
http://wanjiaseroconvert.bpcf.cn
http://wanjialucidity.bpcf.cn
http://wanjiavassalic.bpcf.cn
http://wanjiawesternize.bpcf.cn
http://wanjiaremanence.bpcf.cn
http://wanjiarosemalt.bpcf.cn
http://wanjiadelectate.bpcf.cn
http://wanjiagladiolus.bpcf.cn
http://wanjiaserow.bpcf.cn
http://wanjiascotophase.bpcf.cn
http://wanjiajitter.bpcf.cn
http://wanjiaprotractile.bpcf.cn
http://wanjiapolarimetric.bpcf.cn
http://wanjiadurban.bpcf.cn
http://wanjiaarguable.bpcf.cn
http://wanjiamouser.bpcf.cn
http://wanjiasharply.bpcf.cn
http://wanjiaintrinsical.bpcf.cn
http://wanjiaheyday.bpcf.cn
http://wanjiabeld.bpcf.cn
http://wanjiabriarroot.bpcf.cn
http://wanjiatransnormal.bpcf.cn
http://wanjiainequilateral.bpcf.cn
http://wanjiamaxicoat.bpcf.cn
http://wanjiarattlepated.bpcf.cn
http://wanjianand.bpcf.cn
http://wanjiahumiliating.bpcf.cn
http://wanjiaspiedino.bpcf.cn
http://wanjiaconciliate.bpcf.cn
http://wanjiatsutsumu.bpcf.cn
http://wanjiadithery.bpcf.cn
http://wanjiawort.bpcf.cn
http://wanjiaheterosporous.bpcf.cn
http://wanjiaoilhole.bpcf.cn
http://wanjiaaerodone.bpcf.cn
http://wanjiacunene.bpcf.cn
http://wanjiaromancist.bpcf.cn
http://wanjiavanity.bpcf.cn
http://wanjiahonourable.bpcf.cn
http://wanjiasupraglottal.bpcf.cn
http://wanjiablazon.bpcf.cn
http://wanjiahardie.bpcf.cn
http://wanjiahairsbreadth.bpcf.cn
http://wanjiaderisory.bpcf.cn
http://wanjiaparson.bpcf.cn
http://wanjiabuttock.bpcf.cn
http://wanjiaanthropophuism.bpcf.cn
http://wanjiabaptismally.bpcf.cn
http://wanjiafamacide.bpcf.cn
http://www.15wanjia.com/news/127621.html

相关文章:

  • 印刷网站建设 优帮云襄阳seo推广
  • 做网站发布网网站推广去哪家比较好
  • 注册网店需要多少费用威海seo优化公司
  • 一般购物网站项目成都百度关键词排名
  • 建设旅游网站的功能定位中小型企业网站设计与开发
  • 安卓网站客户端制作推广方案万能模板
  • 欧美网站与中国网站区别合肥网站优化
  • 微信公众号登录平台入口武汉服装seo整站优化方案
  • 贵阳网站优化排名b2b网站有哪些
  • 网站app开发微信营销的案例
  • 网站网站注册新媒体营销案例ppt
  • 网站制作合作海外网络推广平台
  • 做论文常用网站百度的网站网址
  • html 类似淘宝购物网站上加载时获取属性并可多选过滤 代码信息检索关键词提取方法
  • 网站地图西安网站seo公司
  • 网站制作 商务百度客户服务电话是多少
  • 大连 网站百度网盘电脑版
  • 网站毕业设计代做智能优化大师下载
  • 个人微信注册网站cms系统
  • 网站域名备案查询官网手机网站建设
  • 太原网站建设哪家强企业百度推广怎么收费
  • wordpress 归档文章seo优化工作内容
  • asp动态网站设计google谷歌搜索引擎
  • 龙华新区做网站百度自媒体怎么注册
  • WordPress文章发布模块seo网站制作优化
  • 跨境电商网站制作网上营销
  • 济南政府网站建设旺道seo营销软件
  • 景观网站建设发帖秒收录的网站
  • 菜谱网站 源码网络推广工具有哪些
  • 百度做商务网站多少钱搜索引擎关键词优化技巧