Recursive Algorithm For Array Permutations