
merge sort
文章平均质量分 92
flyatcmu
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Sort List
Sort a linked list inO(nlogn) time using constant space complexity. Example 1: Input: 4->2->1->3 Output: 1->2->3->4 Example 2: Input: -1->5->3->4->0 Output: -1->0->3->4->5 思路:merge sort Linked List, jame...原创 2020-09-07 13:46:04 · 209 阅读 · 0 评论 -
Get the Maximum Score
You are given twosortedarrays of distinct integersnums1andnums2. Avalidpathis defined as follows: Choosearray nums1 or nums2 to traverse (from index-0). Traverse the current array from left to right. If you are reading any value that is presen...原创 2020-08-02 14:16:44 · 301 阅读 · 0 评论 -
Merge Sorted Array
Given two sorted integer arraysnums1andnums2, mergenums2intonums1as one sorted array. Note: The number of elements initialized innums1andnums2aremandnrespectively. You may assume tha...原创 2014-01-27 14:37:12 · 665 阅读 · 0 评论 -
Sort an Array
Given an integer array, sort it in ascending order. Use selection sort, bubble sort, insertion sort or any O(n2) algorithm. Example Example 1: Input: [3, 2, 1, 4, 5] Output: [1, 2, 3, 4, 5] E...原创 2019-12-27 13:36:29 · 258 阅读 · 0 评论 -
Sorting (Merge Sort, Rainball Sort, quick select) 总结
Merge k Sorted Lists(这题是用PQ,或者merge sort都可以做,关于第K大的问题,参考: PriorityQueue 第K大问题总结) Sort an Array ( 重点掌握merge sort和quick sort,因为两者可以演变为很多其他的算法,divide conquer, quick select) Merge Intervals Sort Colors Sort List Convert Sorted Array to Binary Searc...原创 2020-07-05 07:08:51 · 476 阅读 · 0 评论 -
Merge Two Sorted Lists
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. 思路: 实际上考察的是mergesort里面的merge一步,很简单直接的merge,注意其中一个没有了的情况。一...原创 2014-01-27 13:56:37 · 557 阅读 · 0 评论 -
Remove Sub-Folders from the Filesystem
Given a list of folders, remove all sub-folders in those folders and return inany orderthe folders after removing. If afolder[i]is located withinanotherfolder[j], it is called asub-folderof it. The format of a path isone or more concatenated str...原创 2020-06-10 12:06:56 · 308 阅读 · 0 评论 -
Time Intersection
Give two users' ordered online time series, and each section records the user's login time pointxand offline time pointy. Find out the time periods when both users are online at the same time, and ...原创 2019-12-05 13:18:34 · 660 阅读 · 0 评论 -
Merge K Sorted Interval Lists
MergeKsorted interval lists into one sorted interval list. You need to merge overlapping intervals too. Example Example1 Input: [ [(1,3),(4,7),(6,8)], [(1,2),(9,10)] ] Output: [(1,3),(4,8),(...原创 2019-11-26 01:14:26 · 190 阅读 · 0 评论 -
Merge Two Sorted Interval Lists
Merge two sorted (ascending) lists of interval and return it as a new sorted list. The new sorted list should be made by splicing together the intervals of the two lists and sorted in ascending order....原创 2019-11-26 01:12:02 · 186 阅读 · 0 评论