定义IntPair 以及IntPair(first,second)的compareto,先比較first的大小,再比較second的大小定义FirstPartitioner是为了让partition的时候依照IntPair的first来做为选择reduce的根据定义FirstGroupingComp...
分类:
其他好文 时间:
2014-06-18 18:57:15
阅读次数:
289
我们知道,一个典型的Map-Reduce过程包 括:Input->Map->Partition->Reduce->Output。Partition负责把Map任务输出的中间结果 按key分发给不同的Reduce任务进行处理。Hadoop 提供了一个很有用的partitioner类KeyFieldBa...
分类:
编程语言 时间:
2014-06-18 17:00:55
阅读次数:
332
Right-BICEPRight首先,我们需要知道什么是正确的.这是最基本的.Boundary边界是否所有的边界条件都正确?CorrectConformance一致性结果值是否和期望值一致.Ordering顺序性值是否跟期望一样,是有序/无序的.Range区间性值是否位于合理的最大值和最小值之间.R...
分类:
其他好文 时间:
2014-06-17 19:51:20
阅读次数:
166
最简单的不相交集的实现,来自MAW的《数据结构与算法分析》。代码:class DisjSet: def __init__(self, NumSets): self.S = [0 for i in range(NumSets+1)] def SetUnion(self, S,...
分类:
编程语言 时间:
2014-06-17 15:17:56
阅读次数:
265
for ( decl : coll ){ statement}where decl is the declaration of each element of the passed collection coll and for which the statements specified are....
分类:
其他好文 时间:
2014-06-15 22:11:18
阅读次数:
295
1 index unique scan 效率最高,主键或唯一索引2 index fast full scan 读的最快,可以并行访问索引,但输出不按顺序3 index full scan 有顺序的输出,不能并行读索引。4 index range scan 在给定的区间查询5 index s...
分类:
其他好文 时间:
2014-06-15 19:41:17
阅读次数:
169
快速排序(Quick Sort)也是一种交换排序,它在排序中采取了分治策略。
快速排序的主要思想是:
从待排序列中选取一元素作为轴值(也叫主元)。
将序列中的剩余元素以该轴值为基准,分为左右两部分。左部分元素不大于轴值,右部分元素不小于轴值。轴值最终位于两部分的分割处。
对左右两部分重复进行这样的分割,直至无可分割。...
分类:
其他好文 时间:
2014-06-15 15:28:14
阅读次数:
301
【Control Flow】1、for loop中的元素可以省略: 2、for initializer中的变量只能在循环内使用。3、if、else if、else的用法: 最后一个else可选。4、switch用法: 5、range match: 6、tuple作为case: 7、va...
分类:
其他好文 时间:
2014-06-15 14:07:20
阅读次数:
283
本文出自:http://blog.csdn.net/svitter
生成1~10的随机数1000个:
import random
fp = open("test", 'w');
for i in range(1, 1000):
a = random.randint(1,10)
fp.write(str(a)+"\n");
fp.close()
注意:写入文件的不会在最后写...
分类:
编程语言 时间:
2014-06-15 13:39:10
阅读次数:
321
Description:Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preser...
分类:
其他好文 时间:
2014-06-14 19:11:15
阅读次数:
173