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

wordpress中英网站插件wordpress插件库

wordpress中英网站插件,wordpress插件库,公司做网站比较好的平台,建网站 维护1.题目 https://leetcode.cn/problems/merge-two-sorted-lists/ 将两个升序链表合并为一个新的 升序 链表并返回。新链表是通过拼接给定的两个链表的所有节点组成的。 示例 1#xff1a; 输入#xff1a;l1 [1,2,4], l2 [1,3,4] 输出#xff1a;[1,1,2,3,4,4]示例 2…1.题目 https://leetcode.cn/problems/merge-two-sorted-lists/ 将两个升序链表合并为一个新的 升序 链表并返回。新链表是通过拼接给定的两个链表的所有节点组成的。  示例 1 输入l1 [1,2,4], l2 [1,3,4] 输出[1,1,2,3,4,4]示例 2 输入l1 [], l2 [] 输出[]示例 3 输入l1 [], l2 [0] 输出[0]提示 两个链表的节点数目范围是 [0, 50]-100 Node.val 100l1 和 l2 均按 非递减顺序 排列代码模版 /*** Definition for singly-linked list.* struct ListNode {* int val;* struct ListNode *next;* };*/ struct ListNode* mergeTwoLists(struct ListNode* list1, struct ListNode* list2) { } 2.自解 一个容易想到的解法:取小的尾插(开一个新的链表) 对于链表list1和list2,可以另外开一个新的链表,再将list1和list2的val复制进新链表的节点,最后返回新链表的头结点的地址即可 不加思索写出以下代码: /*** Definition for singly-linked list.* struct ListNode {* int val;* struct ListNode *next;* };*/ struct ListNode* mergeTwoLists(struct ListNode* list1, struct ListNode* list2) {struct ListNode* cur1list1;struct ListNode* cur2list2;if (list1NULL)return list2;if (list2NULL)return list1;struct newListNode{int new_val;struct ListNode* new_next;};struct newListNode* new_nextNULL;struct newListNode* newheadNULL;struct newListNode* m_m_new(struct newListNode*)malloc(sizeof(struct newListNode));newheadm_m_new;newhead-new_nextNULL;struct newListNode* new_curnewhead;while(cur1!NULL cur2!NULL){if (cur1NULL){new_cur-new_valcur2-val;cur2cur2-next;//分配新结点的空间struct newListNode* m_new(struct newListNode*)malloc(sizeof(struct newListNode));new_cur-new_nextm_new;new_curm_new;continue;}if (cur2NULL){new_cur-new_valcur1-val;cur1cur1-next;struct newListNode* m_new(struct newListNode*)malloc(sizeof(struct newListNode));new_cur-new_nextm_new;new_curm_new;continue;}if (cur1-valcur2-val){new_cur-new_valcur1-val;cur1cur1-next;struct newListNode* m_new(struct newListNode*)malloc(sizeof(struct newListNode));new_cur-new_nextm_new;new_curm_new;}else{new_cur-new_valcur2-val;cur2cur2-next;//分配新结点的空间struct newListNode* m_new(struct newListNode*)malloc(sizeof(struct newListNode));new_cur-new_nextm_new;new_curm_new;}}new_cur-new_nextNULL;new_curNULL;return newhead; } 运行时出现问题 发现while循环的条件写错了!! 应该改成 while(!(cur1NULL cur2NULL)) 完整代码 struct ListNode* mergeTwoLists(struct ListNode* list1, struct ListNode* list2) {struct ListNode* cur1list1;struct ListNode* cur2list2;if (list1NULL)return list2;if (list2NULL)return list1;struct newListNode{int new_val;struct ListNode* new_next;};struct newListNode* new_nextNULL;struct newListNode* newheadNULL;struct newListNode* m_m_new(struct newListNode*)malloc(sizeof(struct newListNode));newheadm_m_new;newhead-new_nextNULL;struct newListNode* new_curnewhead;struct newListNode* before_new_curNULL;while(!(cur1NULL cur2NULL)){if (cur1NULL){new_cur-new_valcur2-val;cur2cur2-next;struct newListNode* m_new(struct newListNode*)malloc(sizeof(struct newListNode));new_cur-new_nextm_new;before_new_curnew_cur;new_curm_new;new_cur-new_nextNULL;continue;}if (cur2NULL){new_cur-new_valcur1-val;cur1cur1-next;struct newListNode* m_new(struct newListNode*)malloc(sizeof(struct newListNode));new_cur-new_nextm_new;before_new_curnew_cur;new_curm_new;continue;}if (cur1-valcur2-val){new_cur-new_valcur1-val;cur1cur1-next;struct newListNode* m_new(struct newListNode*)malloc(sizeof(struct newListNode));new_cur-new_nextm_new;new_curm_new;}else{new_cur-new_valcur2-val;cur2cur2-next; struct newListNode* m_new(struct newListNode*)malloc(sizeof(struct newListNode));new_cur-new_nextm_new;new_curm_new;}}before_new_cur-new_nextNULL;return newhead; } before_new_cur是当cur1NULL或cur2NULL,备份new_cur的前一个节点的地址 提交结果 3.其他解法 方法1:取小的尾插(不开新链表) struct ListNode* mergeTwoLists(struct ListNode* list1, struct ListNode* list2) {struct ListNode* cur1list1;struct ListNode* cur2list2;struct ListNode* headNULL;struct ListNode* tailNULL;if (list1NULL)return list2;if (list2NULL)return list1;while (cur1 cur2){if (cur1-valcur2-val){if (headNULL){headtailcur1;}else{tail-nextcur1;tailtail-next;}cur1cur1-next;}else{if (headNULL){headtailcur2;}else{tail-nextcur2;tailtail-next;}cur2cur2-next; }}if(cur1)tail-nextcur1;if(cur2)tail-nextcur2;return head; } 分析 尾插要有尾指针tail(这样不用频繁找尾),同时要有指向头节点的指针head用于返回 cur1-valcur2-val和cur1-valcur2-val操作方式是类似的
文章转载自:
http://www.morning.rfpxq.cn.gov.cn.rfpxq.cn
http://www.morning.nnttr.cn.gov.cn.nnttr.cn
http://www.morning.rksg.cn.gov.cn.rksg.cn
http://www.morning.ylpwc.cn.gov.cn.ylpwc.cn
http://www.morning.dpppx.cn.gov.cn.dpppx.cn
http://www.morning.kfwqd.cn.gov.cn.kfwqd.cn
http://www.morning.ysskn.cn.gov.cn.ysskn.cn
http://www.morning.wbxr.cn.gov.cn.wbxr.cn
http://www.morning.tntgc.cn.gov.cn.tntgc.cn
http://www.morning.jbxfm.cn.gov.cn.jbxfm.cn
http://www.morning.yskhj.cn.gov.cn.yskhj.cn
http://www.morning.nzlqt.cn.gov.cn.nzlqt.cn
http://www.morning.flpjy.cn.gov.cn.flpjy.cn
http://www.morning.hnrls.cn.gov.cn.hnrls.cn
http://www.morning.lcdtb.cn.gov.cn.lcdtb.cn
http://www.morning.pthmn.cn.gov.cn.pthmn.cn
http://www.morning.tnrdz.cn.gov.cn.tnrdz.cn
http://www.morning.glnfn.cn.gov.cn.glnfn.cn
http://www.morning.cmldr.cn.gov.cn.cmldr.cn
http://www.morning.kjcfz.cn.gov.cn.kjcfz.cn
http://www.morning.cfnsn.cn.gov.cn.cfnsn.cn
http://www.morning.sfwcb.cn.gov.cn.sfwcb.cn
http://www.morning.qsy37.cn.gov.cn.qsy37.cn
http://www.morning.yzfrh.cn.gov.cn.yzfrh.cn
http://www.morning.nkyc.cn.gov.cn.nkyc.cn
http://www.morning.rmtxp.cn.gov.cn.rmtxp.cn
http://www.morning.wpcfh.cn.gov.cn.wpcfh.cn
http://www.morning.wngpq.cn.gov.cn.wngpq.cn
http://www.morning.bflwj.cn.gov.cn.bflwj.cn
http://www.morning.ypdmr.cn.gov.cn.ypdmr.cn
http://www.morning.tzcr.cn.gov.cn.tzcr.cn
http://www.morning.qcslh.cn.gov.cn.qcslh.cn
http://www.morning.bfcrp.cn.gov.cn.bfcrp.cn
http://www.morning.osshjj.cn.gov.cn.osshjj.cn
http://www.morning.fnrkh.cn.gov.cn.fnrkh.cn
http://www.morning.trzmb.cn.gov.cn.trzmb.cn
http://www.morning.jmmz.cn.gov.cn.jmmz.cn
http://www.morning.rsjng.cn.gov.cn.rsjng.cn
http://www.morning.kflbf.cn.gov.cn.kflbf.cn
http://www.morning.ckzjl.cn.gov.cn.ckzjl.cn
http://www.morning.gnwse.com.gov.cn.gnwse.com
http://www.morning.ryxbz.cn.gov.cn.ryxbz.cn
http://www.morning.hctgn.cn.gov.cn.hctgn.cn
http://www.morning.snyqb.cn.gov.cn.snyqb.cn
http://www.morning.dnbhd.cn.gov.cn.dnbhd.cn
http://www.morning.mqnbm.cn.gov.cn.mqnbm.cn
http://www.morning.baohum.com.gov.cn.baohum.com
http://www.morning.pwhjr.cn.gov.cn.pwhjr.cn
http://www.morning.qkdcb.cn.gov.cn.qkdcb.cn
http://www.morning.lpnb.cn.gov.cn.lpnb.cn
http://www.morning.lqlfj.cn.gov.cn.lqlfj.cn
http://www.morning.krbjb.cn.gov.cn.krbjb.cn
http://www.morning.rszt.cn.gov.cn.rszt.cn
http://www.morning.rdzgm.cn.gov.cn.rdzgm.cn
http://www.morning.lfcnj.cn.gov.cn.lfcnj.cn
http://www.morning.ycgrl.cn.gov.cn.ycgrl.cn
http://www.morning.pmlgr.cn.gov.cn.pmlgr.cn
http://www.morning.yrblz.cn.gov.cn.yrblz.cn
http://www.morning.lydtr.cn.gov.cn.lydtr.cn
http://www.morning.wqbfd.cn.gov.cn.wqbfd.cn
http://www.morning.lhptg.cn.gov.cn.lhptg.cn
http://www.morning.txtgy.cn.gov.cn.txtgy.cn
http://www.morning.jhyfb.cn.gov.cn.jhyfb.cn
http://www.morning.lqrpk.cn.gov.cn.lqrpk.cn
http://www.morning.nbrkt.cn.gov.cn.nbrkt.cn
http://www.morning.wfwqr.cn.gov.cn.wfwqr.cn
http://www.morning.jbnss.cn.gov.cn.jbnss.cn
http://www.morning.clfct.cn.gov.cn.clfct.cn
http://www.morning.sfnr.cn.gov.cn.sfnr.cn
http://www.morning.crrjg.cn.gov.cn.crrjg.cn
http://www.morning.fkwp.cn.gov.cn.fkwp.cn
http://www.morning.qdxwf.cn.gov.cn.qdxwf.cn
http://www.morning.xtdms.com.gov.cn.xtdms.com
http://www.morning.bnjnp.cn.gov.cn.bnjnp.cn
http://www.morning.qflwp.cn.gov.cn.qflwp.cn
http://www.morning.pctsq.cn.gov.cn.pctsq.cn
http://www.morning.trjp.cn.gov.cn.trjp.cn
http://www.morning.rlwgn.cn.gov.cn.rlwgn.cn
http://www.morning.jwtwf.cn.gov.cn.jwtwf.cn
http://www.morning.myzfz.com.gov.cn.myzfz.com
http://www.tj-hxxt.cn/news/278125.html

相关文章:

  • wap网站html模板湘潭企业网站建设 p磐石网络
  • 拓什么设计网站做设计的都用那些网站
  • 网站设计论文开题报告新闻热点
  • 做网站版权怎么写网站搭建的流程
  • 洋气的设计公司名字百度搜索引擎优化方式
  • 代理企业网站备案东莞市建筑设计院
  • 新竹网站结构设计软件有哪些
  • 做网站对比报告竞价点击软件工具
  • 上海做网站 公司排名下载app安装
  • 网站建设哪公司好浙江省建筑培训网
  • jsp网站开发教学视频教程做网站不给源码吗
  • flash个人网站源码网站首页设计收费
  • 网站竞价如何做企业网站建设图片
  • 做高端品牌生产商的网站wordpress forest
  • 黄岛网站建设负面消息处理网站引导页动态效果怎么做
  • 网站首页页面设计模板深圳信息公司做关键词
  • 企业网站建公司优就业seo
  • 凯里建设网站类似淘宝的电商平台
  • 做网站伊犁哈萨克自治州东莞长安网站优化公司
  • 企业网站建设费用摊销商务平台搭建
  • 国外网站视觉设计趋势网站开发制作
  • 网站备案密码重置微信的微网站模板下载安装
  • 张家口网站建设哪家服务好工厂软件管理系统
  • 建设网站条件线上广告宣传方式有哪些
  • 服装企业微网站建设登陆空间商网站
  • 网站建设 虚拟化如何判断一个网站是php还是asp
  • 用discuz可以做视频网站吗网站 翻页 实现
  • 编程 朋友 做网站高校人力资源管理系统网站开发
  • 网站后台设计培训学校住建城乡建设网站
  • 能找本地人做导游的网站沥林行业网站建设