Hello,
I need to permute the elements of an array but some specific elements have to be fixed. For example, consider the following array.
array = [1 0 3 0 5 0]
All the 0's in this array must be fixed. Other elements can change their positions, For this example, the following are all the possible results.
1 0 3 0 5 01 0 5 0 3 03 0 1 0 5 03 0 5 0 1 05 0 1 0 3 05 0 3 0 1 0
Also, I need a general algorithm that works for any given 1xn array, and I need all the possible results.
Thanks for your efforts.
Best Answer