Question: Write a Python function cycle2table(cs), whiclh has a list of lists of non-negative integers cs as input. The input represents a permutation in cycle notation,

 Write a Python function cycle2table(cs), whiclh has a list of lists

Write a Python function cycle2table(cs), whiclh has a list of lists of non-negative integers cs as input. The input represents a permutation in cycle notation, as discussed in class. Your function has to verify that the cycles in cs contain all integers in the range from 0 to n for some n, but it is not required that the cycles are disjoint. E.g.,[[0,21,11,4,21,[3]] is a valid input, whereas [[1,2,31,[0,51] is not. We use the convention that cycles are applied from right to left. For instance, the permutation represented by [[0,11,10,1,2]] maps 0 to 0, 1 to 2, and 2 to 1. The return value of cycle2table(cs) is a list of integers images, such that the i-th entry of images is the image of i under the permutation represented by cs. Write a Python function cycle2table(cs), whiclh has a list of lists of non-negative integers cs as input. The input represents a permutation in cycle notation, as discussed in class. Your function has to verify that the cycles in cs contain all integers in the range from 0 to n for some n, but it is not required that the cycles are disjoint. E.g.,[[0,21,11,4,21,[3]] is a valid input, whereas [[1,2,31,[0,51] is not. We use the convention that cycles are applied from right to left. For instance, the permutation represented by [[0,11,10,1,2]] maps 0 to 0, 1 to 2, and 2 to 1. The return value of cycle2table(cs) is a list of integers images, such that the i-th entry of images is the image of i under the permutation represented by cs

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!