I think this is the fastest. Unless you rewrite it in C and you get a bit faster. But the technique itself is the fastest.To improve speed, you might want to look at your problem domain again. What is the purpose of reading this array randomly for so many times? Can you reduce the number of reads? Can you parition the array into smaller arrays and do the reading in parallel using threads? etc.
这些应该都有所帮助,但速度提高不是很多另外也有人说把int改成byte也会好些,以上办法都有些效果但效果不是特别明显
之所以有查找树的各种算法,主要是因为定位过程中需要比较一个KEY,
而数组是不需要的。
这些应该都有所帮助,但速度提高不是很多If you do 把大数组拆分成若干小数组 and then do parallel access, and if you have a multi-processor system, it will definetly help. Even the new Pentium processor that supports hyper threading will show a difference.