THIS IS NOT A NORMAL COMBINATION! We need an algorithm that generates the values of possible combinations of 2 elements (I will be glad to any number), which are used strictly a certain number of times - no more, no less. Roughly speaking, the algorithm places a certain amount of a given element with all possible options. For example, I give the function call and the result of the work in the array:
combination(8,4){ //8 - длина строки для размещения 4 элементов //код } result in array:
array[]={ 00001111, 00010111, 00011011, 00011101, ..., 11110000} For a better understanding, I give a link to the online calculated options - http://integraloff.net/TepBep/cnk.php , enter the value 8 and 4 there.