summaryrefslogtreecommitdiffstats
path: root/Algorithms/Part-II/1-WordNet/Outcast.java
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-04-03 23:39:45 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-04-08 20:57:27 +0200
commit31effd10b34f4de8bbb3a509187eebb5cc0f3b65 (patch)
treedf4a30278f2fb3362d01ba3ca4a691ef73521b64 /Algorithms/Part-II/1-WordNet/Outcast.java
parentb3874c6eb1e17c36d63c693f275f4d1d6ea8e8c1 (diff)
downloadcoursera-31effd10b34f4de8bbb3a509187eebb5cc0f3b65.zip
coursera-31effd10b34f4de8bbb3a509187eebb5cc0f3b65.tar.gz
Algorithms-II : 1-WordNet: speedup using BFS with visited Queue, cleared before bfs()
Diffstat (limited to 'Algorithms/Part-II/1-WordNet/Outcast.java')
-rw-r--r--Algorithms/Part-II/1-WordNet/Outcast.java20
1 files changed, 17 insertions, 3 deletions
diff --git a/Algorithms/Part-II/1-WordNet/Outcast.java b/Algorithms/Part-II/1-WordNet/Outcast.java
index af2b6f3..e9d7911 100644
--- a/Algorithms/Part-II/1-WordNet/Outcast.java
+++ b/Algorithms/Part-II/1-WordNet/Outcast.java
@@ -38,14 +38,28 @@ public class Outcast
Outcast outcast = new Outcast(wordnet);
String[] nouns;
+ Stopwatch st = new Stopwatch();
+ double t0, t1 = 0;
+
nouns = new In("./data/outcast5.txt").readAllStrings();
- StdOut.println(outcast.outcast(nouns));
+ t0 = st.elapsedTime();
+ StdOut.println(outcast.outcast(nouns)+" " + (t0 - t1));
+ t1 = t0;
nouns = new In("./data/outcast8.txt").readAllStrings();
- StdOut.println(outcast.outcast(nouns));
+ t0 = st.elapsedTime();
+ StdOut.println(outcast.outcast(nouns)+" " + (t0 - t1));
+ t1 = t0;
nouns = new In("./data/outcast11.txt").readAllStrings();
- StdOut.println(outcast.outcast(nouns));
+ t0 = st.elapsedTime();
+ StdOut.println(outcast.outcast(nouns)+" " + (t0 - t1));
+ t1 = t0;
+
+ nouns = new In("./data/outcast29.txt").readAllStrings();
+ t0 = st.elapsedTime();
+ StdOut.println(outcast.outcast(nouns)+" " + (t0 - t1));
+ t1 = t0;
}
}