1.经常使用创建方式思考: String text = "this is a test text "; 上面这一句话实际上是运行了三件事 1.声明变量 String text; 2.在内存中开辟空间 (内存空间一) 3.将变量的text的引用指向开辟的内存空间 当有 text = "this is a change text"; 这一句话运行了两件事 1.在内存中开辟空间 2.将变量text 的引用指向 新开辟的内存空间 3.内存空间一此时依旧存在,这就是说明了S
如何从一个1G的文件中找到你所需要的东西,这个问题貌似面试的时候会经常问到.不过不论你用什么语言,肯定逃脱不了按指针读或者按块读. 这里介绍python的用法.本人亲自实验了,速度还可以. 如果你的文件还不是很大,那么最好的方式: with open('log2.txt') as f: for line in f: print line.strip() 貌似这种方式是最快的,不过如果再大点的话,还是比较耗时 这里有个日志文件,请看格式: 现在我们想把开始时间为2015-07-18-18:58:0
//在两个数成对出现的数组中找到一个单独的数.比如{1,2,3.3,1,4.2},即找出4 #include <stdio.h> int find(int arr[], int len) { int i = 0; int ret = 0; for (i = 0; i < len; i++) { ret = ret^arr[i]; } return ret; } int main() { int arr1[] = { 1, 2, 2, 3, 1, 5, 3 }; int arr2[] =
Description The Genographic Project is a research partnership between IBM and The National Geographic Society that is analyzing DNA from hundreds of thousands of contributors to map how the Earth was populated. As an IBM researcher, you have been tas