Given a 1D array of length n. Is it possible to programmatically generate all possible permutations with just rotate and reverse operations applied as many times as required. If yes how(algo)? If not why? Here rotation can be by any d < n, and reverse means to reverse the entire array and not just in parts. Example: Array: 1,2,3,4 Reverse: 4,3,2,1 Rotate by 2: 3,4,1,2
Also given two permutation states A and B of an array. Is it possible to get from state A to state B programmatically using just rotation and reverse operations in any order. If yes how(algo)? If not why? Example: A: 5,3,1,2,4 B: 1,5,3,2,4