Sort a linked list in O(n log n) time using constant space complexity.解决这个问题让我很是纠结,能不能用快速排序呢?我试了很多次,结果总是超时,甚至在用系统自带的stl时也是这样。为什么呢?事后想想,快速排序没有充分利用链表的连贯...
分类:
其他好文 时间:
2014-11-08 13:20:59
阅读次数:
245
SticksProblem's Link:http://poj.org/problem?id=1011Mean:http://poj.org/problem?id=1011&lang=zh-CN&change=trueanalyse:爆搜,但是其中蕴含着很多剪枝。Time complexity: O...
分类:
其他好文 时间:
2014-11-07 20:47:43
阅读次数:
218
Follow up for "Search in Rotated Sorted Array":
What if duplicates are allowed?
Would this affect the run-time complexity? How and why?
Write a function to determine if a given target is in the...
分类:
其他好文 时间:
2014-11-07 19:10:51
阅读次数:
161
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 ord...
分类:
其他好文 时间:
2014-11-06 17:05:57
阅读次数:
134
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 ord...
分类:
其他好文 时间:
2014-11-06 16:36:09
阅读次数:
144
1简介近期对Scala比较感兴趣,买了本《快学Scala》,感觉不错。比《Programming Scala:Tackle Multi-Core Complexity on the Java Virtual Machine》好很多。 是本不错的入门书。而且每个章节都设置了难度级别,每章有习题,可以巩...
分类:
其他好文 时间:
2014-11-06 12:35:48
阅读次数:
147
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 ord...
分类:
其他好文 时间:
2014-11-02 12:11:14
阅读次数:
215
What is a high-performance data structure? To answer that question, we're used to applying normal considerations like Big-Oh complexity, and memory ov...
分类:
其他好文 时间:
2014-10-31 20:32:41
阅读次数:
153
问题描述:
Given an array of integers, every element appears three times except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it ...
分类:
其他好文 时间:
2014-10-30 11:52:50
阅读次数:
256
There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time
complexity should be O(log (m+n)).
题意:寻找两个有序数组的中位数,要求复杂度为O(log
(m+...
分类:
其他好文 时间:
2014-10-29 22:23:33
阅读次数:
226