Unsorting(randomizing) a sequence

Dan Schmidt dfan at harmonixmusic.com
Thu Aug 19 10:04:46 EDT 1999


Ian Clarke <I.Clarke at strs.co.uk> writes:

| I did some timing tests using the code I have attached below, here are
| the results (in seconds) for sorting a list of 200 items 10 times:
| 
| Dan Schmidt's solution (using sort): 14.98
|
| def s1(list):
|     """Dan Schmidt's solution - (mis)using sort"""
|     def randomize(a,b):
|         return random.choice([-1, 0, 1])
|     list.sort(randomize)
|     return 

That was Jeremy Hylton's solution.  I just complained about it!

it's-libel-I-tell-you-ly y'rs,
Dan

-- 
                 Dan Schmidt -> dfan at harmonixmusic.com, dfan at alum.mit.edu
Honest Bob & the                http://www2.thecia.net/users/dfan/
Factory-to-Dealer Incentives -> http://www2.thecia.net/users/dfan/hbob/
          Gamelan Galak Tika -> http://web.mit.edu/galak-tika/www/




More information about the Python-list mailing list