Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0e0f6b7

Browse files
committed
Test: sort unit tests
- quicksort implementation test. - insertionsort implementation tests.
1 parent 7eb7204 commit 0e0f6b7

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed
1.59 KB
Binary file not shown.
155 Bytes
Binary file not shown.

‎Data Structures with Java/Code/src/edu/bostonuniversity/utils/SortTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ public void doIt() {
1010
long start, end, time;
1111
int[] data;
1212

13-
data = new int[200000];
13+
data = new int[15];
1414
for (int i = 0; i < data.length; i++) {
15-
int j = (int) (Math.random() * 100000);
15+
int j = (int) (Math.random() * 100);
1616
data[i] = j;
1717
}
1818

@@ -25,11 +25,11 @@ public void doIt() {
2525
end = System.nanoTime();
2626
time = end - start;
2727
System.out.println("Quick sort took: " + time / 1000000000.0 + " seconds");
28-
//for (int datum : data) { System.out.print(datum + " "); }
28+
for (int datum : data) { System.out.print(datum + " "); }
2929

3030
// Randomize data again for insertion sort
3131
for (int i = 0; i < data.length; i++) {
32-
int j = (int) (Math.random() * 100000);
32+
int j = (int) (Math.random() * 100);
3333
data[i] = j;
3434
}
3535

@@ -40,6 +40,6 @@ public void doIt() {
4040
end = System.nanoTime();
4141
time = end - start;
4242
System.out.println("Insertion sort took: " + time / 1000000000.0 + " seconds");
43-
//for (int datum : data) { System.out.print(datum + " "); }
43+
for (int datum : data) { System.out.print(datum + " "); }
4444
}
4545
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /