Skip to content

Instantly share code, notes, and snippets.

@haya14busa
Created November 7, 2013 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haya14busa/7353030 to your computer and use it in GitHub Desktop.
Save haya14busa/7353030 to your computer and use it in GitHub Desktop.
def generatePermutation(items):
if len(items) == 0:
yield []
for i in xrange(len(items)):
for j in generatePermutation(items[:i]+items[i+1:]):
yield [items[i]]+j
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment