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

网站后台策划石家庄企业如何建网站

网站后台策划,石家庄企业如何建网站,网站建设合同属于什么印花税,qq推广引流怎么做1.合并两个升序链表#xff08;创建头节点 简化代码#xff09; ListNode* lowlisthead(ListNode*)malloc(sizeof(ListNode)); 新颖之处就是创建头节点#xff08;哨兵位#xff09;能够减少代码#xff0c;不用每次都判断链表是否为NULL#xff0c; 注意的是#xff1a…1.合并两个升序链表创建头节点 简化代码 ListNode* lowlisthead(ListNode*)malloc(sizeof(ListNode)); 新颖之处就是创建头节点哨兵位能够减少代码不用每次都判断链表是否为NULL 注意的是最后函数的返回值是头节点的下一个地址lowlisthead-next //1.合并两个升序链表创建头节点 简化代码 typedef int SLTDataType;typedef struct SListnode {SLTDataType val;struct SListnode* next; }ListNode;ListNode* createNode(SLTDataType val) {ListNode* newnode (ListNode*)malloc(sizeof(ListNode));if (newnode NULL){perror(malloc);exit(1);}newnode-val val;newnode-next NULL;return newnode; }ListNode* mergeTwoLists(ListNode* L1, ListNode* L2) {ListNode* lowlisthead(ListNode*)malloc(sizeof(ListNode));ListNode* pcur lowlisthead;while (L1 L2){if (L1-val L2-val){pcur-next L1;pcur pcur-next;L1 L1-next;}else{pcur-next L2;pcur pcur-next;L2 L2-next;}//pcur pcur-next; 不能将判断语句里面的节点指针的移动 放在这里 确保在每次链接节点后正确地移动当前指针 pcur}if (L1){pcur-next L1;}if (L2){pcur-next L2;}return lowlisthead-next;}int main() {ListNode* list1, * list2;//创建两个链表list1 createNode(1);list1-next createNode(2);list1-next-next createNode(4);list2 createNode(1);list2-next createNode(3);list2-next-next createNode(5);ListNode* head mergeTwoLists(list1, list2);while (head){printf(%d , head-val);head head-next;}return 0; } 2.合并两个升序链表不创建头节点  //2.合并两个升序链表不创建头节点typedef int SLTDataType; typedef struct SListnode {SLTDataType val;struct SListnode* next; }ListNode;ListNode* createNode(SLTDataType val) {ListNode* newnode (ListNode*)malloc(sizeof(ListNode));if (newnode NULL){perror(malloc);exit(1);}newnode-val val;newnode-next NULL;return newnode; }//ListNode* mergeTwoLists(ListNode* L1, ListNode* L2) //{ // ListNode* lowlisthead, * highlisthead; // lowlisthead highlisthead NULL; // // ListNode* pcur1, *pcur2; // pcur1 lowlisthead; // pcur2 highlisthead; // while(L1 L2) // { // if (L1-val L2-val) // { // if (lowlisthead NULL) // { // lowlisthead L1; // } // else // { // pcur1-next L1; // pcur1 pcur1-next; // } // L1 L1-next; // } // else // { // if (highlisthead NULL) // { // highlisthead L2; // } // else // { // pcur2-next L2; // pcur2 pcur2-next; // } // L2 L2-next; // } // } // if (L1) // { // pcur1-next L1; // } // if (L2) // { // pcur2-next L2; // } // //}ListNode* mergeTwoLists(ListNode* L1, ListNode* L2) {ListNode* lowlisthead, * pcur;pcur lowlisthead NULL;while (L1 L2){if (L1-val L2-val){if (lowlisthead NULL){lowlisthead pcur L1;}else{pcur-next L1;pcur pcur-next;}L1 L1-next;}else{if (lowlisthead NULL){lowlisthead pcur L2;}else{pcur-next L2;pcur pcur-next;}L2 L2-next;}//pcur pcur-next; 不能将判断语句里面的节点指针的移动 放在这里 确保在每次链接节点后正确地移动当前指针 pcur}if (L1){pcur-next L1;}if (L2){pcur-next L2;}return lowlisthead;}int main() {ListNode* list1,*list2;//创建两个链表list1 createNode(1);list1-next createNode(2);list1-next-next createNode(4);list2 createNode(1);list2-next createNode(3);list2-next-next createNode(5);ListNode* head mergeTwoLists(list1, list2);while(head){printf(%d , head-val);head head-next;}return 0; }
http://www.zqtcl.cn/news/963923/

相关文章:

  • 怎么做网站官方电话手机应用开发平台
  • 济南企业免费建站剪辑视频怎么学
  • 手表网站免费设计上海做网站制作
  • 深圳网站seo优化课程设计做淘宝网站的目的
  • 机械网站建设中心莱芜论坛莱芜都市网
  • 58同城类似的网站怎么做seo做的比较好的公司
  • 厦门网站建设培训学校网站程序定制开发流程
  • 宣传旅游网站建设的观点是什么资阳网站建设方案
  • ui设计与网站建设怎么建设一个手机网站
  • 网站建设加推广优化网站移动端开发公司
  • 猪八戒网站开发电子商务公司取名字参考大全
  • 酒泉手机网站建设大连网站如何制作
  • 做网站点子免费做简历的软件网站
  • 刘涛做代言的那个网站设计与制作
  • 专业网站建站星辰wordpress主题
  • 淄博个人网站建设天津网站制作机玩法部
  • 帮人做图挣外快的网站seo优化教学视频
  • 做房产中介需要有内部网站吗烟台开发区网站建设
  • 网站资质优化网站备案密码使用
  • 廊坊营销网站团队网站推广报告
  • 商品网站模板多语言企业网站模板
  • 佛山网页制作设计东莞seo推广机构帖子
  • 公司网站开发费用如何入账网站开发与设计实训总结两千字
  • 生物网站模板在线crm厂商
  • 在线制作动画网站ps切图做网站
  • 西安企业网站建设公司虚拟主机可以做视频网站嘛
  • 做淘客网站用什么程序今天杭州新闻最新消息
  • 东莞专业建网站网站制作方案相信乐云seo
  • 网站分页符素材怎么解决
  • 行远金华网站建设公司合肥公司做网站