I believe this function does what you wish: def to_cycles(perm): pi = {i+1: perm[i] for i in range(len(perm))} cycles = [] while pi: elem0 ...
確定! 回上一頁