-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBenchmark
More file actions
75 lines (66 loc) · 2.35 KB
/
Benchmark
File metadata and controls
75 lines (66 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package edu.ser222.m02_01;
/**
* An interface that defines a student's solution to the Section 02.01
* programming homework. Contains methods that make up the structural core of a
* sorting algorithm benchmarking tool.
*
* @author Ruben Acuna, Robert Sedgewick
* @version 1.1
*/
public interface BenchmarkTool {
/**
* Generates an array of integers where half the data is 0s, half 1s.
* @param size number of elements in the array.
* @return generated test set.
*/
public Integer[] generateTestDataBinary(int size);
/**
* Generates an array of integers where half the data is 0s, half the
* remainder is 1s, half the reminder is 2s, half the reminder is 3s, and so
* forth.
*
* @param size number of elements in the array.
* @return generated test set.
*/
public Integer[] generateTestDataHalves(int size);
/**
* Generates an array of integers where half the data is 0s, and half random
* int values. All values will be positive.
* @param size
* @return
*/
public Integer[] generateTestDataHalfRandom(int size);
/**
* Computes the double formula value for two run times.
*
* @param t1 first time
* @param t2 second time
* @return b value
*/
public double computeDoublingFormula(double t1, double t2);
/**
* Computes an empirical b value for insertion sort by running it on a pair
* of inputs and using the doubling formula.
*
* @param small small test data array
* @param large large test data array. twice the same of small array.
* @return b value
*/
public double benchmarkInsertionSort(Integer[] small, Integer[] large);
/**
* Computes an empirical b value for shellsort sort by running it on a pair
* of inputs and using the doubling formula.
* @param small small test data array
* @param large large test data array. twice the same of small array.
*
* @return b value
*/
public double benchmarkShellsort(Integer[] small, Integer[] large);
/**
* Runs the two sorting algorithms on the three types of test data to
* produce six different b values. B values are displayed to the user.
*
* @param size size of benchmark array. to be doubled later.
*/
public void runBenchmarks(int size);
}