Walking through permutations: You will code a function in SINGULAR that take as input a permutation and an integer n (= size of the permutation) and returns another permutation according to the following algorithm. Assume your permutation is given as a list of integers Algorithm: walk from right to left until first decent a b c d e a < b > c > d > e find a number to the right of a which is bigger than a but the smallest one bigger than a say this is e replace a with e then sort a and the rest of the numbers to the right of a and stick them after e (this "sorting" step is not as hard as sorting a general string of integers...do you see why?) Examples: Ex 1 Input: 1 5 4 3 2 a b c d e 2 5 4 3 1 Output: 2 1 3 4 5 Ex 2 Input: 1 3 2 5 4 a e 1 3 4 5 2 e a Output: 1 3 4 2 5 Ex 3 Input: 1 9 10 8 7 6 5 4 3 2 1 10 9 8 7 6 5 4 3 2 Output: 1 10 2 3 4 5 6 7 8 9 Singular Implementation: Write a function list next_perm(list p, int n) { Code that gives me the next permutation according to the algorithm written at the top of this document here, n is the length of the permutation p if the input p is the biggest permutation [n (n-1) ... 2 1] then this should return 0 } example functionality: list p = 1,3,2,5,4; next_perm( p, 5 ); (should output 1,3,4,2,5) list p = 3,2,1; next_perm( p, 3 ); (should output 0) ADDITIONAL PROCEDURE: Write a function that takes as input a positive integer m and prints out all permutations of size m. This function should uses next_perm() and a WHILE loop to print out all of these permutations.