列表推导式(list
comprehension)是利用其他列表创建新列表(类似于数学术语中的集合推导式)的一种方法。它的工作方式类似于for循环,也很简单:In [39]:
[x*x for x in range(10)]Out[39]: [0, 1, 4, 9, 16, 25, 36, 49, ...
分类:
编程语言 时间:
2014-05-05 22:21:48
阅读次数:
422
用 'top -i' 看看有多少进程处于 Running 状态,可能系统存在内存或 I/O 瓶颈,用 free 看看系统内存使用情况,swap 是否被占用很多,用 iostat 看看 I/O 负载情况...
还有一种办法是 ps -ef | sort -k7 ,将进程按运行时间排序,看哪个进程消耗的cpu时间最多。
top:
主要参数
d:指定更新的间隔,以秒计算。
q:没有任何延迟...
分类:
系统相关 时间:
2014-05-05 13:09:00
阅读次数:
526
windows下安装redis1、redis简介redis是一个key-value存储系统。和Memcached类似,它支持存储的value类型相对更多,包括string(字符串)、list(链表)、set(集合)、zset(sorted
set --有序集合)和hashs(哈希类型)。这些数据类型...
awk 中除了函数的参数列表(Argument
List)上的参数(Arguments)外,所有变量不管于何处出现,全被视为全局变量。其生命持续至程序结束——该变量不论在function外或
function内皆可使用,只要变量名称相同所使用的就是同一个变量,直到程序结束。因递归函数内部的变量,.....
分类:
其他好文 时间:
2014-05-04 11:49:11
阅读次数:
316
Input
t – the number of numbers in list, then t lines follow [t
Each line contains one integer: N [0 N
Output
Output given numbers in non decreasing order.
Example
Input:
5
5
3
...
分类:
其他好文 时间:
2014-05-04 00:04:09
阅读次数:
376
一、接口那点事儿 (1)什么是接口? 一组函数成员而未实现的引用类型。只有类和结构能实现接口。
(2)从IComparable接口看接口实例:
假设有如下一段代码,它使用Array类的一个静态方法Sort对一个未排序的int类型数组进行排序,并输出排序后的结果。using System;cl...
分类:
其他好文 时间:
2014-05-03 22:20:59
阅读次数:
462
You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenation of each word in L exactly once and without an...
分类:
其他好文 时间:
2014-05-03 21:35:49
阅读次数:
310
list1 = [ 4, 7, 7, 3, 3, 3, 2, 1 ]
list2 = [ 5, 4, 3, 3, 2, 2, 2, 1, 1, 1 ]
def havel_hakimi_algo( degree_list ):
degree_list.sort( reverse = True )
print degree_list
for degr...
分类:
编程语言 时间:
2014-05-03 17:13:49
阅读次数:
426
【题目】
B
Age Sort
Input: Standard Input
Output: Standard Output
You are given the ages (in years) of all people of a country with at least 1 year of age. You kn...
分类:
其他好文 时间:
2014-05-03 16:51:42
阅读次数:
427
RDD的依赖关系
Rdd之间的依赖关系通过rdd中的getDependencies来进行表示,
在提交job后,会通过在DAGShuduler.submitStage-->getMissingParentStages
privatedefgetMissingParentStages(stage:
Stage): List[Stage] = {
valmissing
=newHash...
分类:
其他好文 时间:
2014-05-03 15:56:22
阅读次数:
282