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

个人介绍微电影网站模板怎么去营销自己的产品

个人介绍微电影网站模板,怎么去营销自己的产品,知乎网站建设,wordpress页面的template链表OJ 题目一#xff1a;移除链表元素题目二#xff1a;反转链表题目三#xff1a;链表的中间节点题目四#xff1a;链表中倒数第k个结点题目五#xff1a;合并两个有序链表题目六#xff1a;链表分割题目七#xff1a;链表的回文结构题目八#xff1a;相交链表题目九… 链表OJ 题目一移除链表元素题目二反转链表题目三链表的中间节点题目四链表中倒数第k个结点题目五合并两个有序链表题目六链表分割题目七链表的回文结构题目八相交链表题目九环形链表题目十环形链表II 题目一移除链表元素 OJ 方案一 题目解析 代码演示 struct ListNode {int val;struct ListNode* next; }; struct ListNode* removeElements(struct ListNode* head, int val) {struct ListNode* cur head, * prev NULL;while (cur){if (cur-val val){if (cur head){head cur-next;free(cur);cur head;}else{prev-next cur-next;free(cur);cur prev-next;}}else{prev cur;cur cur-next;}}return head; }方案二 题目解析把原链表遍历一遍插入新链表 struct ListNode* removeElements(struct ListNode* head, int val) {struct ListNode* newnode NULL, * tail NULL;struct ListNode* cur head;while (cur){if (cur-val val){struct ListNode* del cur;cur cur-next;free(del);}else{if (tail NULL){newnode tail cur;//tail tail-next;}else{tail-next cur;tail tail-next;}cur cur-next;}}if (tail)tail-next NULL;return newnode; }题目二反转链表 OJ 题目解析 代码演示 struct ListNode {int val;struct ListNode* next; }; struct ListNode* reverseList(struct ListNode* head) {struct ListNode* newnode NULL, * cur head;while (cur){struct ListNode* next cur-next;//尾插cur-next newnode;newnode cur;cur next;}return newnode; }题目三链表的中间节点 OJ 题目解析 代码演示 struct ListNode {int val;struct ListNode* next; }; struct ListNode* middleNode(struct ListNode* head) {struct ListNode* fast head, * slow head;while (fast fast-next){slow slow-next;fast fast-next-next;}return slow; }题目四链表中倒数第k个结点 OJ 题目解析 代码演示 struct ListNode {int val;struct ListNode* next; }; struct ListNode* FindKthToTail(struct ListNode* pListHead, int k) {struct ListNode* fast pListHead, * slow pListHead;while (k--){if (fast NULL)return NULL;fast fast-next;}while (fast){slow slow-next;fast fast-next;}return slow; }题目五合并两个有序链表 OJ 题目解析 代码演示 struct ListNode {int val;struct ListNode* next; }; struct ListNode* mergeTwoLists(struct ListNode* list1, struct ListNode* list2) {if (list1 NULL)return list2;if (list2 NULL)return list1;struct ListNode* tail NULL, * head NULL;head tail (struct ListNode*)malloc(sizeof(struct ListNode));while (list1 list2){if (list1-val list2-val){tail-next list1;tail tail-next;list1 list1-next;}else{tail-next list2;tail tail-next;list2 list2-next;}}if (list1)tail-next list1;if (list2)tail-next list2;struct ListNode* del head;head head-next;free(del);return head; }题目六链表分割 OJ 题目解析 代码演示 struct ListNode {int val;struct ListNode* next;ListNode(int x) : val(x), next(NULL) {} }; class Partition { public:ListNode* partition(ListNode* pHead, int x) {struct ListNode* lhead, * ltail, * gtail, * ghead;ghead gtail (struct ListNode*)malloc(sizeof(struct ListNode));lhead ltail (struct ListNode*)malloc(sizeof(struct ListNode));struct ListNode* cur pHead;while (cur){if (cur-val x){ltail-next cur;ltail ltail-next;}else{gtail-next cur;gtail gtail-next;}cur cur-next;}ltail-next ghead-next;gtail-next NULL;struct ListNode* head lhead-next;free(lhead);free(ghead);return head;} };题目七链表的回文结构 OJ 题目解析 代码演示 struct ListNode {int val;struct ListNode* next;ListNode(int x) : val(x), next(NULL) {} }; class PalindromeList { public:struct ListNode* middleNode(struct ListNode* head){struct ListNode* fast head, * slow head;while (fast fast-next){slow slow-next;fast fast-next-next;}return slow;}struct ListNode* reverseList(struct ListNode* head){struct ListNode* newnode NULL, * cur head;while (cur){struct ListNode* next cur-next;cur-next newnode;newnode cur;cur next;}return newnode;}bool chkPalindrome(ListNode* A){struct ListNode* mid middleNode(A);struct ListNode* rmid reverseList(mid);while (A rmid){if (A-val ! rmid-val)return false;A A-next;rmid rmid-next;}return true;} };题目八相交链表 OJ 题目解析 定义快慢指针使快指针先走与慢指针同步。然后同时走看是否相交 代码演示 struct ListNode {int val;struct ListNode* next; }; struct ListNode* getIntersectionNode(struct ListNode* headA, struct ListNode* headB) {struct ListNode* curA headA, * curB headB;int lenA 1, lenB 1;while (curA){curA curA-next;lenA;}while (curB){curB curB-next;lenB;}if (curA ! curB)return false;int gab abs(lenA - lenB);struct ListNode* longest headA, * shortest headB;if (lenA lenB){longest headB;shortest headA;}while (gab--){longest longest-next;}while (shortest ! longest){shortest shortest-next;longest longest-next;}return longest; }题目九环形链表 OJ 题目解析 代码演示 struct ListNode {int val;struct ListNode* next; }; bool hasCycle(struct ListNode* head) {struct ListNode* fast head, * slow head;while (fast fast-next){slow slow-next;fast fast-next-next;if (slow fast)return true;}return false; }题目十环形链表II OJ 题目解析 代码演示 struct ListNode {int val;struct ListNode* next; }; struct ListNode* detectCycle(struct ListNode* head) {struct ListNode* fast head, * slow head;while (fast fast-next){slow slow-next;fast fast-next-next;if (slow fast){struct ListNode* meet slow;while(meet ! head){head head-next;meet meet-next;}return meet;}}return NULL; }不知不觉【数据结构初阶】链表OJ以告一段落。通读全文的你肯定收获满满让我们继续为数据结构学习共同奋进!!!
http://www.w-s-a.com/news/721660/

相关文章:

  • 电子商务网站开发开题报告wordpress更改后台地址
  • 网站静态前端是什么工作
  • 餐饮门户网站 方案怎么做创业好项目
  • 做百度手机网站推广普通话的宣传标语
  • 记事本可以做网站吗网站服务器是主机吗
  • 手机网站被拦截怎么办怎么解决东营建设信息网网
  • 外贸网站模板免费微信网站开发技术
  • 视频盗版网站怎么做福州网站seo
  • 成都金铭 网站建设做网站包含的技术
  • 长沙的网站建设公司哪家好做网站应选那个主题
  • 公司网站百度搜不到如何自己做一个网站
  • 学生如何建设网站网站开发程序
  • 网站建设公司哪家好 皆来磐石网络网站建设"淘宝网" 在颜色选取和搭配方面有哪些值得学习的地方.
  • 网站如何做移动规则适配北京住房与城乡建设部网站
  • 课堂阵地建设网站wordpress运行机制
  • 网站建设的需求方案企业网站建设费用明细
  • 创口贴网站模板京创影视app
  • 团购网站建设目的网站有很多304状态码
  • 运用阿里云怎么做网站外资企业可以在中国境内做网站吗
  • 云南住房和城乡建设局网站西安做官网的公司
  • 企业网站图片上传网站建设和应用的情况
  • 网站不显示内容吗聊城网架公司
  • 南昌网站建设企业网站托管外包怎么做
  • 做非洲外贸的网站网站可以用PS设计吗
  • PHP搭建IDC网站青岛福瀛建设集团网站
  • 安徽网站优化多少钱软件界面设计的基本原则
  • 网站建设动态页面修改删除dnf卖飞机的网站怎么做的
  • 万网是做什么的seo综合
  • 网站关键词分隔符php网站开发平台下载
  • 郑州那家做网站便宜商业计划书免费word版