求反交集算法
来源:互联网 发布:mac app原型设计工具 编辑:程序博客网 时间:2024/05/20 05:10
package data.BitSet;
import java.io.IOException;
import java.util.Random;
public class Data {
public static void main(String[] args)throws Exception {
test();
}
/**
* 求反交集
* @throws IOException
*/
public static void test() throws IOException {
int[] randomNums = new int[10000000];
Random random = new Random();
for (int i = 0, length = randomNums.length; i < length; i++) {
randomNums[i] = random.nextInt(10000000);
}
long start = System.currentTimeMillis();
boolean[] bitArray = new boolean[10000000];
for (int i = 0, length = randomNums.length; i < length; i++) {
bitArray[randomNums[i]] = true;
}
for (int i = 0, length = bitArray.length; i < length; i++) {
if (bitArray[i]) {
continue;
}
//System.out.println(i);
}
long end = System.currentTimeMillis();
System.out.println("Spend milliseconds: " + (end - start));
}
}
本文来自网络转载itoyo
- 求反交集算法
- 基本算法,求交集
- 区间求交集算法
- java字符串求交集算法
- 算法&大数据--(1)求交集
- 求交集
- 求交集
- 基本归并算法(求两个集合的交集)
- 以单链表存储的两个集合求交集的算法
- 最快速度求两个数组之交集算法
- 【算法题集锦之二】--多个集合求交集
- 求交集和并集的线性算法
- 最快速度求两个数组之交集算法
- 最快速度求两个数组之交集算法与hash
- 求交集和并集的线性算法
- 算法 n1段区间 与 n2段区间求交集
- set求交集
- 用map求交集
- HDU-4081 Qin Shi Huang's National Road System(最小生成树[Prim])
- hdu 5411 CRB and Puzzle 2015 多校联合训练赛#10 快速矩阵幂
- 一年之后再来更新
- HDU 1026 Ignatius and the Princess I (BFS)
- boost::any的用法、优点和缺点以及源代码分析
- 求反交集算法
- Perl学习(五)
- OC不可变数组NSArray详解
- 通过configSource提高web.config配置灵活性
- 用C语言求一元二次方程的根
- 内存堆和栈的区别
- UVA表达式树的后序遍历和层次遍历和建树
- 【Cocos2dx】使用CCScale9Sprite拉伸图片
- 指针