Constructing all permutations Posted on 2018-08-31 | Post modified 2018-08-31 | In Algorithms , Languages , Backtracking , Python Algorithm1234567891011121314151617from combinatorial_search import Backtrackingclass Permutation(Backtracking): def is_a_solution(self, current_answer, kth, info): return kth == len(info) def generate_candidates(self, current_answer, kth, info): return [candidate for candidate in info if candidate not in current_answer] def process_solution(self, current_answer, kth, info): print(current_answer) def permute(self, info): self.backtrack([], 0, info)# test casePermutation().permute([1,2,3]) Reference https://en.wikipedia.org/wiki/Permutation