Skip to content

Instantly share code, notes, and snippets.

@haya14busa
Created November 7, 2013 11:16
Show Gist options
  • Select an option

  • Save haya14busa/7353030 to your computer and use it in GitHub Desktop.

Select an option

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