summaryrefslogtreecommitdiffstats
path: root/Algorithms/Part-II/3-BaseballElimination/BaseballElimination.java
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2013-12-19 11:44:54 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2013-12-19 11:44:54 +0100
commit85d02e1e5ca422a5aacd0eb67654a53dfe624964 (patch)
treee340d0a5d3c3b29cf2b823f06b4079bad24e883f /Algorithms/Part-II/3-BaseballElimination/BaseballElimination.java
parent3bfea3f9126bb991a1bdf25428a72e17963abf62 (diff)
downloadcoursera-85d02e1e5ca422a5aacd0eb67654a53dfe624964.zip
coursera-85d02e1e5ca422a5aacd0eb67654a53dfe624964.tar.gz
Algorithms-II : 3-BaseballElimination: add prototypes and data
Diffstat (limited to 'Algorithms/Part-II/3-BaseballElimination/BaseballElimination.java')
-rw-r--r--Algorithms/Part-II/3-BaseballElimination/BaseballElimination.java64
1 files changed, 64 insertions, 0 deletions
diff --git a/Algorithms/Part-II/3-BaseballElimination/BaseballElimination.java b/Algorithms/Part-II/3-BaseballElimination/BaseballElimination.java
new file mode 100644
index 0000000..3021da6
--- /dev/null
+++ b/Algorithms/Part-II/3-BaseballElimination/BaseballElimination.java
@@ -0,0 +1,64 @@
+/* vim: set expandtab tabstop=4 shiftwidth=4 : */
+
+public class BaseballElimination
+{
+ public BaseballElimination(String filename)
+ {
+ // create a baseball division from given filename in format specified below
+ }
+ public int numberOfTeams()
+ {
+ // number of teams
+ return 0;
+ }
+ public Iterable<String> teams()
+ {
+ // all teams
+ return null;
+ }
+ public int wins(String team)
+ {
+ // number of wins for given team
+ return 0;
+ }
+ public int losses(String team)
+ {
+ // number of losses for given team
+ return 0;
+ }
+ public int remaining(String team)
+ {
+ // number of remaining games for given team
+ return 0;
+ }
+ public int against(String team1, String team2)
+ {
+ // number of remaining games between team1 and team2
+ return 0;
+ }
+ public boolean isEliminated(String team)
+ {
+ // is given team eliminated?
+ return false;
+ }
+ public Iterable<String> certificateOfElimination(String team)
+ {
+ // subset R of teams that eliminates given team; null if not eliminated
+ return null;
+ }
+
+ public static void main(String[] args) {
+ BaseballElimination division = new BaseballElimination(args[0]);
+ for (String team : division.teams()) {
+ if (division.isEliminated(team)) {
+ StdOut.print(team + " is eliminated by the subset R = { ");
+ for (String t : division.certificateOfElimination(team))
+ StdOut.print(t + " ");
+ StdOut.println("}");
+ }
+ else {
+ StdOut.println(team + " is not eliminated");
+ }
+ }
+ }
+}