diff options
Diffstat (limited to 'Algorithms/Part-II/3-BaseballElimination/BaseballElimination.java')
-rw-r--r-- | Algorithms/Part-II/3-BaseballElimination/BaseballElimination.java | 64 |
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"); + } + } + } +} |