def test_permute_iter(self):
     it = permute_iter("abc")
     perms = ['abc', 'bac', 'bca', 'acb', 'cab', 'cba']
     for i in range(len(perms)):
         self.assertEqual(perms[i], next(it))
 def test_permute_iter(self):
     it = permute_iter("abc")
     perms = ["abc", "bac", "bca", "acb", "cab", "cba"]
     for i in range(len(perms)):
         self.assertEqual(perms[i], next(it))
Example #3
0
 def test_permute_iter(self):
     it = permute_iter("abc")
     perms = ['abc', 'bac', 'bca', 'acb', 'cab', 'cba']
     for i in range(len(perms)):
         self.assertEqual(perms[i], next(it))
Example #4
0
from algorithms.backtrack import permute, permute_iter, permute_recursive

a = [1, 2, 3]
b = "123"
blist = []
aperm = permute(b)
print(aperm)

bperm = permute_iter(a)
for i in bperm:
    blist.append(i)
print(blist)

print(permute_recursive(a))

#박제준 4/27