-
Notifications
You must be signed in to change notification settings - Fork 452
Expand file tree
/
Copy pathMain.java
More file actions
24 lines (19 loc) · 715 Bytes
/
Main.java
File metadata and controls
24 lines (19 loc) · 715 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/**
* Created by liuyubobobo.
*/
public class Main {
public static void main(String[] args) {
// 数据规模倍乘测试findMax
// O(n)
System.out.println("Test for findMax:");
for( int i = 10 ; i <= 28 ; i ++ ){
int n = (int)Math.pow(2, i);
Integer[] arr = MyUtil.generateRandomArray(n, 0, 100000000);
long startTime = System.currentTimeMillis();
Integer maxValue = MyAlgorithmTester.findMax(arr, n);
long endTime = System.currentTimeMillis();
System.out.print("data size 2^" + i + " = " + n + "\t");
System.out.println("Time cost: " + (endTime - startTime) + " ms");
}
}
}