Created
March 27, 2019 00:11
-
-
Save iMel408/eee9b89dd7ca3a7a32fe7bb31b3b2a9b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
samp_list = ['m','e','l'] | |
def list_perm(prefix,suffix): | |
suffix_size = len(suffix) | |
if suffix_size == 0: | |
print(prefix) | |
else: | |
for i in range(0,suffix_size): | |
new_pre = prefix + [suffix[i]] # [] + ['m'] | |
new_suff = suffix[:i] + suffix[i+1:] # [] + ['e','l'] | |
list_perm(new_pre, new_suff) | |
list_perm([],samp_list) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment