algorithm puzzlesolve( , , )inputan integer ksequence sand set outputan enumeration of all -length extensions to using elements in without repetitions for each in do add to the end of remove from { is now being usedif = then test whether is configuration that solves the puzzle if solves the puzzle then return "solution founds else puzzlesolve( - , , { recursive callremove from the end of add back to { is now considered as unusedcode fragment solving combinatorial puzzle by enumerating and testing all possible configurations in figure we show recursion trace of call to puzzlesolve( , )where is empty and {abcduring the executionall the permutations of the three characters are generated and tested note that the initial call makes three recursive callseach of which in turn makes two more if we had executed puzzlesolve( , on set consisting of four elementsthe initial call would have made four recursive callseach of which would have trace looking like the one in figure initial call puzzlesolve( ){ , , }puzzlesolve( { , }puzzlesolve( ab{ }abc puzzlesolve( { , }puzzlesolve( ba{ }bac puzzlesolve( ac{ }acb puzzlesolve( { , }puzzlesolve( ca{ }cab puzzlesolve( bc{ }bca puzzlesolve( cb{ }cba figure recursion trace for an execution of puzzlesolve( , )where is empty and {abcthis execution generates and tests all permutations of aband we show the permutations generated directly below their respective boxes