permutation for given array