[Tutor] A (not so) simple question? Round Robin

Glen Wheeler wheelege@tsn.cc
Mon, 18 Jun 2001 20:37:51 +1000


>
>
> Yesterday I posted a solution to the 'round-robin'-problem asked for
> by Adam Gordon.
>
> This solution (shown below) delivers solutions to the "test-data" of the
>
> problem-setting (i. e. for up to 10 teams) immediately.
>
> However, for a solution for 12 teams it needs 4 secs (on my machine),
> and for 14 teams 2400 secs. Sort of exponential runtime-behaviour.
>
> Consequently arises the question not only for a more beautiful program,
> but also for a more efficient algorithm (for there are certainly
> competitions with more than 14 teams).
>
> Seems interesting to me (although it probably is a so called 'well
> known'
> problem.)
>
> Well known to somebody of you?
>

  Hmmm well with regards to the performance issue, I did notice quite a few
'in' keywords.  And we all know what linear buggers they are :)  This script
could probably benefit exponentailly (ha ha) from using dictionaries as
opposed to lists, then a simple has_key() call instead of 'in'.
  The beauty I can't really help you with - my python programs struggle to
be elegant, let alone beautiful.  Although I do know of several that I
consider so...just not the ones I code :)
  It sure is an interesting problem.  Perhaps a whole new unexpected
approach would make it all alot easier?  Brute force is usually just the tip
of an iceberg.

  Glen.