table sample output from optimal selection program the asterisks mark the objects that form the optimal sets opts for the total weight limits ranging from to this backtracking scheme with limitation factor curtailing the growth of the potential search tree is also known as branch and bound algorithm exercises (towers of hanoigiven are three rods and disks of different sizes the disks can be stacked up on the rodsthereby forming towers let the disks initially be placed on rod in the order of decreasing sizeas shown in fig for the task is to move the disks from rod to rod such that they are ordered in the original way this has to be achieved under the constraints that in each step exactly one disk is moved from one rod to another rod disk may never be placed on top of smaller disk rod may be used as an auxiliary store find an algorithm that performs this task note that tower may conveniently be considered as consisting of the single disk at the topand the tower consisting of the remaining disks describe the algorithm as recursive program fig the towers of hanoi write procedure that generates all npermutations of elements an- in situi without the aid of another array upon generating the next permutationa parametric procedure is to be called which mayfor instanceoutput the generated permutation hintconsider the task of generating all permutations of the elements am- as consisting of the subtasks of generating all permutations of am- followed by am- where in the -th subtask the two elements ai and am- had initially been interchanged deduce the recursion scheme of fig which is superposition of the four curves the structure is similar to that of the sierpinski curves in fig from the recursion patternderive recursive program that draws these curves