Skip to content

Instantly share code, notes, and snippets.

@Gnitset
Last active December 16, 2015 03:59
Show Gist options
  • Save Gnitset/5373368 to your computer and use it in GitHub Desktop.
Save Gnitset/5373368 to your computer and use it in GitHub Desktop.
def is_sorted(a):
for (c,d) in enumerate(a):
if c!=d:
return False
return True
def shuffle(a):
a_len=len(a)
map(a.extend,zip(a[:a_len/2],a[a_len/2:a_len]))
del a[:a_len]
def try_deck(size):
a=range(size)
shuffle(a)
i=1
while not is_sorted(a):
shuffle(a)
i+=1
return i
for Z in range(2,1025,2):
print Z,try_deck(Z)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment