language agnostic - Algorithm to determine the highest and lowest possible finishing position of a team in a league -
not sure if appropriate question so, here goes:
i interested in required logic needed able calculate highest , lowest possible finishing position of team in league.
take example english premier league. there 20 teams in league. each team hosts every other team in league once @ home. means each team plays each other twice (once @ home , once away), , play 38 games in season.
a game can end in 1 of 3 results- home win, draw, or away win. teams awarded 3 points win, , 1 point draw. means maximum amount of points team can achieve in single season 114 (38*3).
the bottom of year's premier league table looks (position, team name, games played, goal difference [goals scored - goals conceded], points) :

i want know newcastle's highest , lowest possible finishing positions.
it rational think newcastle's lowest finishing position season 18th, if newcastle lose remaining game, , teams below them (with exception of qpr , reading can't catch newcastle) win games, points total higher newcastle's (wigan's same, fact have had 2 wins, , newcastle have had 1 loss mean wigan have superior goal difference [the mechanism separate teams on equal points]).
however- (and complicated bit)- aston villa's final game of season against wigan. reason, impossible both teams gain maximum points.
so question is- best way accurately determine highest , lowest possible finishing place of given team in league, whilst taking account remaining fixtures of rival teams? should @ every remaining fixture , calculate each permutation? or there smarter way this?
you can reduce number of combination ignoring irrelevant ones.
the steps below finding lowest possible position. finding highest possible position handled in similar way.
when considering lowest possible position, teams ahead irrelevant.
also teams cannot enough points reach newcastle in remaining games irrelevant.
for remaining teams, consider each game against irrelevant team won.
the above step can make more teams irrelevant. if so, repeat previous step!
brute-force remaining games, i.e. games relevant teams face each other.
Comments
Post a Comment