摘要: ```c++ Node *flatten(Node *head) { Node *it = head; stack stack1; while (it) { if (it->child) { stack1.push(it->next); it->next = it->child; ... 阅读全文
posted @ 2019-01-12 23:34 INnoVation-V2 阅读(192) 评论(0) 推荐(0) 编辑
摘要: ```c++ ListNode *reverse(ListNode *head) { ListNode *front = head, *rear = nullptr, *temp = nullptr; while (front != nullptr) { temp = front->next; front->next = rear; ... 阅读全文
posted @ 2019-01-12 18:14 INnoVation-V2 阅读(93) 评论(0) 推荐(0) 编辑
摘要: 自己写的不够简洁 阅读全文
posted @ 2019-01-12 18:02 INnoVation-V2 阅读(99) 评论(0) 推荐(0) 编辑
摘要: ```c++ ListNode *insertionSortList(ListNode *head) { if (head == nullptr || head->next == nullptr) return head; auto *prehead = new ListNode(0), *front = prehead; prehead->next = h... 阅读全文
posted @ 2019-01-12 17:40 INnoVation-V2 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 方法一 活用set 方法二 快慢指针找中点然后反转后半部分链表,然后插入到前半个链表当中去 阅读全文
posted @ 2019-01-12 16:41 INnoVation-V2 阅读(173) 评论(0) 推荐(0) 编辑
摘要: ```c++ TreeNode *BST(ListNode *begin, ListNode *end) { if (begin == end) return nullptr; ListNode *fast = begin, *slow = begin; while (fast->next != end) { fast = fast->nex... 阅读全文
posted @ 2019-01-12 15:38 INnoVation-V2 阅读(99) 评论(0) 推荐(0) 编辑