I don't know if it's possible, but I'm trying to find, in C#, an algorithm which can generate all the permutations of a set of number with some "empty space" in it while keeping its order.
Example :
I have an array [1,2] and I need all the ordered permutations with two "Empty space". In this case, I will have :
[1,2,null,null]
[1,null,2,null]
[1,null,null,2]
[null,1,2,null]
[null,1,null,2]
[null,null,1,2]
I have tried to include all the "empty space" inside the array before doing a permutation, but it yield too much permutations that I do not need.
in C#, the function could be
private static List<int[]> PermutateWithSpace(this List<int> set, int numberOfEmptySpace)
{
// Algorithm which yield all possible permutations of my N "null" inside my set
}