![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
链表
zhaohoutao
这个作者很懒,什么都没留下…
展开
-
LeetCode-142 链表环
链表相交/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNo...原创 2019-06-28 09:43:25 · 111 阅读 · 0 评论 -
LeetCode 138 复制带随机指针的链表
复制带随机指针的链表/*// Definition for a Node.class Node {public: int val; Node* next; Node* random; Node() {} Node(int _val, Node* _next, Node* _random) { val = _val; ...原创 2019-08-12 13:27:35 · 72 阅读 · 0 评论 -
LeetCode 25 K 个一组翻转链表
K 个一组翻转链表/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: L...原创 2019-08-11 21:41:29 · 61 阅读 · 0 评论 -
LeetCode 82 删除排序链表中的重复元素 II
删除排序链表中的重复元素 II/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public:...原创 2019-08-14 20:28:26 · 77 阅读 · 0 评论 -
LeetCode 61 旋转链表
旋转链表/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNo...原创 2019-08-14 18:24:31 · 65 阅读 · 0 评论 -
LeetCode 148 排序链表
排序链表/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNo...原创 2019-08-09 14:46:07 · 73 阅读 · 0 评论 -
LeetCode 109 有序链表转换二叉搜索树
有序链表转换二叉搜索树/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; *//** * Definition for a bina...原创 2019-07-20 23:26:04 · 74 阅读 · 0 评论 -
LeetCode 203 移除链表元素
移除链表元素/**Definition for singly-linked list.struct ListNode {int val;ListNode *next;ListNode(int x) : val(x), next(NULL) {}};/class Solution {public:ListNode removeElements(ListNo...原创 2019-07-16 23:01:15 · 94 阅读 · 0 评论 -
LeetCode 234 回文链表
回文链表自己的代码超出时间/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public:...原创 2019-07-16 20:43:56 · 59 阅读 · 0 评论 -
LeetCode-237 删除链表中的节点
删除链表中的节点/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: vo...原创 2019-07-18 23:34:19 · 56 阅读 · 0 评论 -
LeetCode-24 两两交换链表中的节点
两两交换链表中的节点对于链表题的注意事项:1.对于跳跃型的链表需要判断node!=NULL&&node->next!=NULL2.操作链表的时候需要的时候一定要要拷贝一份头指针3.需要拷贝一下下一个节点,因为可能会因为删除next指针导致断链了/** * Definition for singly-linked list. * struct ListNode ...原创 2019-07-09 22:55:50 · 58 阅读 · 0 评论 -
LeetCode-23 合并k个排序链表
合并k个排序链表使用暴力求解使用分治法,递归/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solutio...原创 2019-06-28 23:37:39 · 88 阅读 · 0 评论 -
LeetCode-86 分割链表
分割链表/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNo...原创 2019-06-28 22:39:32 · 105 阅读 · 0 评论 -
二叉树转换成链表和搜索二叉树转换成双链表
`二叉树转换成链表``/**Definition for a binary tree node.struct TreeNode {int val;TreeNode *left;TreeNode *right;TreeNode(int x) : val(x), left(NULL), right(NULL) {}};/class Solution {p...原创 2019-08-28 14:28:43 · 179 阅读 · 0 评论