数据结构-链表
Peppermint__
这个作者很懒,什么都没留下…
展开
-
LeetCode 23.Merge k Sorted List 合并k个有序链表(后补)
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 题目描述 讲k个有序链表合并为一个链表,并且保持有序状态。 思路1 将所有的链表的头结点放到最小堆里面,每提取一个结点,就将该结点的下一个结点放在堆里。public class MergeKSort原创 2018-02-26 16:46:51 · 172 阅读 · 0 评论 -
LeetCode 25. Reverse Nodes in k-Group
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive integer and is less than or equal to the length of the linked list. If the number of原创 2018-02-26 17:00:10 · 138 阅读 · 0 评论 -
LeetCode 148.Sort List 链表排序
Sort a linked list in O(n log n) time using constant space complexity. 题目链接 题目大意 对一个链表进行排序,复杂度在O(nlogn)内。 思路 我写的是归并排序,注意分开后的左边链表的尾结点的next置null。 public class SortList { public ListNode原创 2018-02-26 16:34:46 · 465 阅读 · 0 评论