NYCPHP Meetup

NYPHP.org

[nycphp-talk] OT: webmaster test

John Campbell jcampbell1 at gmail.com
Mon Apr 14 19:14:43 EDT 2008


>  Given a single elimination tennis tournament (you loose a match and you're
> out)
>  with N players. How many matches are required to determine a winner? Here
> is
>  an example, four players A, B, C, and D. In the first round, A play B and C
> plays
>  D. A and D win. So far 2 matches and 2 players go to next round.

rounds = ceil(ln(N)/ln(2));
games = N-1;


-John C.



More information about the talk mailing list