GithubHelp home page GithubHelp logo

asoke26 / baseball-elimination Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 3.39 MB

Baseball Elimination is a classic problem of MaxFlow Mincut algorithm. Given the standings in a sports league at some point during the season, determine which teams have been mathematically eliminated from winning their division.

C++ 94.56% Makefile 5.44%
algorithms-and-data-structures maxflow-mincut

baseball-elimination's Introduction

Baseball-Elimination

Problem Description :

Baseball Elimination is a classic problem of MaxFlow Mincut algorithm. Given the standings in a sports league at some point during the season, determine which teams have been mathematically eliminated from winning their division.

In the baseball elimination problem, there is a league consisting of N teams. At some point during the season, team i has w_i wins and r_ij games left to play against team j. A team is eliminated if it cannot possibly finish the season in first place or tied for first place. The goal is to determine exactly which teams are eliminated.


Figure 1: Sample Point table

Montreal is mathematically eliminated since it can finish with at most 80 wins and Atlanta already has 83 wins.Philadelphiais also mathematically eliminated. It can finish the season with as many as 83 wins, which appears to be enough to tieAtlanta. But this would require Atlanta to lose all of its remaining games, including the 6 against New York, in which case New York would finish with 84 wins. We note thatNew Yorkis not yet mathematically eliminated despite the fact that it has fewer wins than Philadelphia.

Input:

Input consists of Multiple lines. First line have variable N that denotes number of teams. Following N lines will have team name labeled/indexed as {0,1...N-1}, number of wins,number of loses, remaining games to be played and distribution of remaining games against each teams. Figure 1 describes a sample input for required program.

Output:

Output will be team name {0,1...N-1}, separated by space. e.g. 0 2 if 0 and 2 are the teams eliminated.
Output for Figure 1 :
1 2

Assumptions

Assume that no games end in a tie,no rainouts, Ignore wildcard possibilities,assume that there are no whitespace characters in the name of a team.

References:

[1] https://www.cs.princeton.edu/courses/archive/spr03/cs226/assignments/baseball.html
[2] https://www.cs.princeton.edu/~wayne/papers/baseball_talk.pdf
[3] https://github.com/nastra/AlgorithmsPartII-Princeton

baseball-elimination's People

Contributors

asoke26 avatar rahul664 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

rahul664

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.