I am trying to solve this question - Given an array A of N elements and a permutation P, apply P to A.
For example, the permutation P = {2,0,1,3} applied to an array A = {a,b,c,d} yields the array {b,c,a,d}.
Can this be performed without additional storage and without modifying P?
Performing this using additional space or modifying P is straight forward.