Skip to content

Commit

Permalink
First turnin
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkDecaydence committed Feb 24, 2012
1 parent 1313f32 commit c6322a6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 6 additions & 2 deletions miningnobel/MiningNobel.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ public static int fastCount(double[] ds) {
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
for (int k = j + 1; k < n; k++) {
int l = Arrays.binarySearch(ds, -(ds[i] + ds[j] + ds[k]));
if (ds[i] + ds[j] + ds[k] - l == 0) count++;
double target = -(ds[i] + ds[j] + ds[k]);
int l = Arrays.binarySearch(ds, target);
if (l > k) count++;
}
}
}
Expand All @@ -52,6 +53,9 @@ public static void main(String[] args) {
Stopwatch sw = new Stopwatch();
StdOut.println("Exhaustive search count: " + exhaustiveCount(A));
StdOut.println("Exhaustive search time: " + sw.elapsedTime());
sw = new Stopwatch();
StdOut.println("Fast search count: " + fastCount(A));
StdOut.println("Fast search time: " + sw.elapsedTime());
in.close();
}

Expand Down
8 changes: 4 additions & 4 deletions miningnobel/README-MiningNobel.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/**********************************************************************
/**********************************************************************
* Programming assignment: Mining for Nobel
**********************************************************************/

Name1: Lars Toft Jacobsen
Email1: [email protected]
Name2: Alexander Kirk Jørgensen
Email2: [email protected]
Group name: Algorythms
Group name: Algorythms && Lord of the Code

Operating system: Mac OS X / ?
Text editor / IDE: TextMate / ?
Operating system: Mac OS X / Windows 7
Text editor / IDE: TextMate / Notepad++

Optional: Total hours to complete assignment:

Expand Down

0 comments on commit c6322a6

Please sign in to comment.