Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.分析:一个很简单的解法是调用k-1次merge two sorted linkedlist,假设每个list...
分类:
其他好文 时间:
2014-11-25 00:03:02
阅读次数:
207
Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.思路:开始做过两两合并的链表,此时做k路合并,即将k个链表进行合并,可以先将这k个链表进行两两合并,知道合并...
分类:
其他好文 时间:
2014-11-24 18:43:48
阅读次数:
137
Sort a linked list in O(n log n)
time using constant space complexity.
大家看完题目估计跟我一样啦。。。都在想哪些是nlogn啊~快速排序、归并排序、堆排序!然后开始愁,这些东西变成list了可怎么办啊。。。
可是我深深地记得在CMU的时候老师告诉我,java现在自带的Arrays.sort用的是快排,然后我就想,那么…...
分类:
编程语言 时间:
2014-11-24 10:10:04
阅读次数:
170
Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). For example,S = "ADOBECOD...
# 题目 > Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). For example, S = "ADOBECODEBANC" T = "ABC" Minimum window is "B...
分类:
其他好文 时间:
2014-11-23 23:36:47
阅读次数:
411
Follow up for "Search in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-time complexity? How and why?Write a function to...
分类:
其他好文 时间:
2014-11-22 22:52:33
阅读次数:
262
Follow upfor "Find Minimum in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-time complexity? How and why?Suppose a sort...
分类:
其他好文 时间:
2014-11-22 20:07:33
阅读次数:
154
Follow up for "Find Minimum in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?前面那道题:Find ...
分类:
其他好文 时间:
2014-11-22 11:59:28
阅读次数:
162
Follow up for "Find Minimum in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Suppose a s...
分类:
其他好文 时间:
2014-11-22 07:03:46
阅读次数:
206
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.Have you met this question in a real interview?Analy...
分类:
其他好文 时间:
2014-11-22 07:03:11
阅读次数:
192