I will not find the algorithm. There is a two-dimensional array of D (unlimited rows, n columns known, but may vary). There is an array M of m elements. How to get all possible options for filling D elements M , provided that the element D[i,j] can be filled only if the element D[i-1,j] filled?
As an example. Let n=4 , m=3 , M = {m1, m2, m3} ? Then we can fill D , for example:
{m1, , m2, m3} {d1, d2, d3, d4} - это просто индексы столбцов D или {m3, , , } {m1, , m2, } {d1, d2, d3, d4} но нельзя делать так (т.к. элемент m3 "оторван" получается) { , m3, , } {m1, , m2, } {d1, d2, d3, d4} Is there any algorithm for getting all possible fill combinations?