Search for a Range
Given a sorted array of integers, find the starting and ending position of a given target value.
Your algorithm's runtime complexity must be in the order of O(log n).
If...
分类:
其他好文 时间:
2015-07-09 14:41:20
阅读次数:
87
Question:Follow up for "Search in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-time complexity? How and why?Write a fu...
分类:
其他好文 时间:
2015-07-08 22:28:49
阅读次数:
162
A classic interview question. This link has a nice explanation of the idea using two stacks and its amortized time complexity.I use the same idea in m...
分类:
其他好文 时间:
2015-07-07 12:33:18
阅读次数:
102
Merge k Sorted Lists
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
思路:此题是由合并两个排序链表演化而来,刚开始,想法比较简单,像求最大公共前缀一样,逐一求解;但是最后超时,所以马上意识到出题方是为了使用归并和分...
分类:
编程语言 时间:
2015-07-07 09:31:31
阅读次数:
131
问题描述Given a sorted array of integers, find the starting and ending position of a given target value.
Your algorithm’s runtime complexity must be in the order of O(log n).
If the target is not found i...
分类:
其他好文 时间:
2015-07-06 14:23:26
阅读次数:
110
Given a sorted array of integers, find the starting and ending position of a given target value.
Your algorithm's runtime complexity must be in the order of O(log n).
If the target is not found ...
分类:
其他好文 时间:
2015-07-04 12:45:48
阅读次数:
99
https://leetcode.com/problems/sort-list/Sort ListSort a linked list inO(nlogn) time using constant space complexity.来自http://www.cnblogs.com/zuoyuan/p...
分类:
其他好文 时间:
2015-07-02 22:15:21
阅读次数:
149
Factorial Trailing ZeroesGiven an integern, return the number of trailing zeroes inn!.Note:Your solution should be in logarithmic time complexity.Cred...
分类:
其他好文 时间:
2015-07-02 13:49:59
阅读次数:
101
Description:Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must b...
分类:
其他好文 时间:
2015-06-28 01:09:44
阅读次数:
120
题目链接 题目要求: Sort a linked list inO(nlogn) time using constant space complexity. 满足O(nlogn)时间复杂度的有快排、归并排序、堆排序。在这里采用的是归并排序(空间复杂度O(logn)),具体程序如下: 1 /...
分类:
其他好文 时间:
2015-06-27 19:53:14
阅读次数:
102