摘要:
Sort a linked list using insertion sort. 利用插入排序对一个链表进行排序 思路和数组中的插入排序一样,不过每次都要从链表头部找一个合适的位置,而不是像数组一样可以从要插入的位置开始从后往前找合适的位置 阅读全文
摘要:
Sort a linked list in O(n log n) time using constant space complexity. 以时间复杂度O(n log n)排序一个链表。 归并排序,在链表中不需要多余的主存空间 tricks:用快慢指针找到中间位置,划分链表 阅读全文
摘要:
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, 阅读全文
摘要:
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were initia 阅读全文
摘要:
Given a collection of intervals, merge all overlapping intervals. For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18]. 合并重叠区间 阅读全文