Question: kindly follow this algorithm to solve the question. Part B Permutation Generator Take a look at the algorithm Permutation Generator given in the text Mathematical



kindly follow this algorithm to solve the question.
Part B Permutation Generator Take a look at the algorithm Permutation Generator given in the text Mathematical Structures for Computer Science on pages 282-283. The algorithm takes a set of n integers and generates a list of all possible permutations of those integers. Answer the following questions to analyze the algorithm. 1. If the set consists of the integers {1,2,3,4,5), how many permutations are possible? 2. If the set consists of the integers {1,2,3,4,...,10), how many permutations are possible? 3. Fill in the table below showing the number of permutations possible on a set of n integers for various values of n. Use scientific notation where appropriate. n Number of Permutations 5 10 15 20 25 30 4. If the set consists of the integers {1,2,3,4,...n}, how many permutations are possible? 5. Classify the algorithm using Big-O notation. 6. If it takes a computer 10^(-12) seconds to generate one permutation, how long would it take to run the algorithm on the set {1,2,3,4,...10} ? For which values of n is it reasonable to run this algorithm on the set {1,2,3,4,...n} ? Explain. ALGORITHM PERMUTATION GENERATOR PermGenerator integer n 22) generates in lexicographical order all permutations Wof the integers in the set II..... Local variables: integers i.) //indices of permutation elements integerk W for loop counter integers di.dz...d Wieft to right elements of a permutation Vicreate and write out smallest permutation for k=1 to n do d, end for write did...de Vereate and write out remaining permutations for k2ton! do ook right to left for first break in increasing sequence =N-1 while d >d do'still increasing right to left ii- 1 = -1 end while Tinow d
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
