Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -0,0 +1,12 @@
|
|||
import operator
|
||||
import random
|
||||
from itertools import dropwhile, imap, islice, izip, repeat, starmap
|
||||
|
||||
def shuffled(x):
|
||||
x = x[:]
|
||||
random.shuffle(x)
|
||||
return x
|
||||
|
||||
bogosort = lambda l: next(dropwhile(
|
||||
lambda l: not all(starmap(operator.le, izip(l, islice(l, 1, None)))),
|
||||
imap(shuffled, repeat(l))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue