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

网站用哪个软件做网站开发的私活

网站用哪个软件做,网站开发的私活,开发商城网站建设,网站建设及安全管理文档链表常用技巧和操作总结 常用技巧 画图 引入虚拟头节点 不要吝啬空间#xff0c;大胆定义变量 快慢双指针常用操作 创建一个新节点 尾插 头插 两数相加 ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) {int carry 0;ListNode* newHead new ListNode, *cur newHea…链表常用技巧和操作总结 常用技巧 画图 引入虚拟头节点 不要吝啬空间大胆定义变量 快慢双指针常用操作 创建一个新节点 尾插 头插 两数相加 ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) {int carry 0;ListNode* newHead new ListNode, *cur newHead;while (l1 ! nullptr l2 ! nullptr) {int num l1-val l2-val carry;carry num / 10;num num % 10;cur-next new ListNode(num);cur cur-next;l1 l1-next;l2 l2-next;}while (l1 ! nullptr) {int num l1-val carry;carry num / 10;num num % 10;cur-next new ListNode(num);cur cur-next;l1 l1-next;}while (l2 ! nullptr) {int num l2-val carry;carry num / 10;num num % 10;cur-next new ListNode(num);cur cur-next;l2 l2-next;}if (carry ! 0) {cur-next new ListNode(carry);}return newHead-next; }两两交换链表中的节点 ListNode* swapPairs(ListNode* head) {if (head nullptr || head-next nullptr) return head;ListNode *front head, *back front-next, *newHead new ListNode, *cur newHead;while (true) {cur-next back;ListNode* tmp back-next;back-next front;front-next tmp;cur front;if (tmp ! nullptr tmp-next ! nullptr) {front tmp;back front-next;} else if (tmp ! nullptr tmp-next nullptr) {cur-next tmp;return newHead-next;} else {return newHead-next;}} }重排链表 ListNode* reverse(ListNode* head) {if (head nullptr || head-next nullptr) return head;ListNode* newHead reverse(head-next);head-next-next head;head-next nullptr;return newHead; } void reorderList(ListNode* head) {ListNode *slow head, *fast head;while (fast ! nullptr fast-next ! nullptr) {slow slow-next;fast fast-next-next;}ListNode* cur1 head, *cur2 reverse(slow);ListNode* newHead new ListNode, *cur newHead;while (cur1 ! cur2 cur2 ! nullptr) {cur-next cur1;cur1 cur1-next;cur cur-next;cur-next cur2;cur2 cur2-next;cur cur-next;} }合并 K 个升序链表 // 解法一 ListNode* mergeKLists(vectorListNode* lists) {// 小根堆priority_queueListNode*, vectorListNode*, Comp pq;for (ListNode* e : lists) {if (e ! nullptr) {pq.push(e);}}ListNode *newHead new ListNode, *cur newHead;while (!pq.empty()) {cur-next pq.top();cur cur-next;pq.pop();if (cur-next ! nullptr) {pq.push(cur-next);}}return newHead-next; }// 解法二 ListNode* merge_sort(vectorListNode* lists, int start, int end) {if (start end) return nullptr;else if (start end) return lists[start];int mid start (end - start) / 2;ListNode* left merge_sort(lists, start, mid);ListNode* right merge_sort(lists, mid 1, end);if (left nullptr) return right;else if (right nullptr) return left;ListNode *newHead new ListNode, *cur newHead;while (left ! nullptr right ! nullptr) {if (left-val right-val) {cur-next left;left left-next;} else {cur-next right;right right-next;}cur cur-next;}while (left ! nullptr) {cur-next left;left left-next;cur cur-next;}while (right ! nullptr) {cur-next right;right right-next;cur cur-next;}return newHead-next; } ListNode* mergeKLists(vectorListNode* lists) {return merge_sort(lists, 0, lists.size() - 1); }K 个一组翻转链表 ListNode* reverseKGroup(ListNode* head, int k) {int total 0;ListNode* cur head;while (cur ! nullptr) {total;cur cur-next;}ListNode* newHead new ListNode;cur newHead;while (head ! nullptr) {int count k;ListNode* tail head;if (total k) {while (count-- head ! nullptr) {ListNode* tmp head-next;head-next cur-next;cur-next head;head tmp;}total - k;}cur tail;if (total k) {cur-next head;break;}}return newHead-next; }
http://www.hkea.cn/news/14289676/

相关文章:

  • 爱站网综合查询辽宁省建设局网站
  • 做网站做论坛赚钱吗邮箱网站架构
  • 广告公司 网站模板网页页面制作流程
  • 网站设计论文开题报告长页在线制作网站
  • 宠物寄养网站毕业设计服务器维护
  • asp做企业网站很好啊源代码网站开发
  • 泰安做网站建设的公司哪家好WordPress蜘蛛爬行插件
  • 网站建设与维护课难吗做百度企业网站有什么好处
  • 建立 wiki 网站wordpress 更改ico
  • 做网站链接怎么把wordpress字去掉
  • 云南网站建设一条龙上海注册公司收费
  • 百度公司可以建设网站qq免费申请账号
  • 微信小程序联盟网站作一手房用什么做网站
  • 深圳营销网站设计dedecms建站教程
  • 昆山网站设计wordpress侧边
  • 网站模板怎么进wordpress讨论群
  • 建网站 开发app推广网站哪里好
  • 网站建设公司排行硬件开发文档模板
  • 国外调色网站建站的公司
  • 网站建设合同细节企业制作网站
  • 关键词密度查询站长工具如何做网站怎么赚钱吗
  • 惊艳的网站设计深圳成交型网站建设公司
  • win7本机做网站自己电脑做网站服务器小工具
  • 自己做网站运营太原网站建设方案推广
  • 哪家公司可以做网站东莞网络销售的网站建设
  • 做吃的网站jsp网站开发实例精讲
  • 让人做网站 需要准备什么条件前几年做哪个网站能致富
  • 17网站一起做网店广州沙河android wordpress 源码
  • 360提示的危险网站wordpress rest json
  • 开福区城乡建设局网站品牌宣传海报设计制作