题目:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a sin....
分类:
编程语言 时间:
2014-07-24 10:01:23
阅读次数:
223
本文介绍从无序数组中选择最大值和最小值的最优算法。进而介绍采用快速排序思想的 RANDOMIZED-SELECT 选择算法来查找给定位置 i 的值,或获取中位数(median)。快速排序会递归地处理划分的两边,而 RANDOMIZED-SELECT 则只处理一边。所以快速排序的期望运行时间是 Θ(n...
分类:
其他好文 时间:
2014-07-24 04:58:28
阅读次数:
355
Gray CodeThe gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integernrepresenting the tot...
分类:
其他好文 时间:
2014-07-24 00:53:27
阅读次数:
198
1.hashMap方法O(n)空间换时间public class Solution { public int[] twoSum(int[] numbers, int target) { HashMap hash=new HashMap(); int ans[]=ne...
分类:
其他好文 时间:
2014-07-23 22:20:57
阅读次数:
262
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4736解题思路:在treap里面加上一个num域,用来表示这个节点重复数的个数就行!WA了很多次,发现自己在处理负数的时候有点问题了。然后拿cxlove 的SBT代码比对...
分类:
其他好文 时间:
2014-07-23 22:18:07
阅读次数:
361
#Red hat enterprise linux variants ##Two install sets available ##两种安装方案 ###Server rhel server rhea advanced platform ###Desktop rhel desktop workstation option Multi-OS option ##RH network #...
分类:
Web程序 时间:
2014-07-23 21:33:26
阅读次数:
283
python 字典排序http://www.cnblogs.com/kaituorensheng/archive/2012/08/07/2627386.html函数原型sorted(dic,value,reverse)dic为比较函数,value 为排序的对象(这里指键或键值),reverse:注明...
分类:
编程语言 时间:
2014-07-23 20:52:35
阅读次数:
183
Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.题解:最开始用了最naive的方法,每次在k个链表头中找出最小的元素,插入到新链表中。结果果断TLE了。分析...
分类:
其他好文 时间:
2014-07-23 16:56:31
阅读次数:
227
Add Two NumbersYou are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes co...
分类:
其他好文 时间:
2014-07-23 16:51:51
阅读次数:
251
Given a strings1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation...
分类:
其他好文 时间:
2014-07-23 15:06:06
阅读次数:
320