摘要:
java中提供很多集合类,比如ArrayList,HashMap等等。但你有没有发现其中的这些集合类都是泛型的,有的时候你会发现用泛型会比较慢。慢在哪呢?慢就慢在基本类型的装包和拆包。当你处理大数量的时候,这个慢有的时候就不能接受了。那这怎么解决呢?推荐大家使用fastutil,一个意大利实验室出品,主要用在其的WebGraph上。下面是其官方网站对其的介绍:fastutil extends the Java™ Collections Framework by providing type-specific maps, sets, lists and queues with a small m 阅读全文
摘要:
Write a method to compute all permutations of a string.
翻译:写一个计算一个字符串所有排列的算法。 [方法1] 递归的方法
首先字符串分为a[0,1,...,n-2]和a[n-1]两部分,然后将递归求解a[0,1,...,n-2]的所有排列,最后将a[n-1]插入到a[0,1,...,n-2]的所有排列中去(注意一共有n个插入点)
代码如下... 阅读全文
摘要:
Imagine a robot sitting on the upper left hand corner of an NxN grid The robot can only move in two directions: right and down How many possible paths are there for the robot?翻译:一个机器人在一个NxN的方格上的左上角,只能... 阅读全文
摘要:
screen是一个很好的bash保存的工具,可以保存你现有的工作,网上有很多关于这个的配置,我找了一个精简了一下,个人感觉还是很不错的: #se the startup message startup_message off term linux ##use ` as the Global Key ## escape `` ##set a biger buffer defscro... 阅读全文