-2

I write a function to take elements on a set and create blobs. For example: given the set [1, 2, 3, 4, 5] and 2 chunks with 2 elements, we can create e.g. set-element [[1,2], [3,4]] and [[4,3], [1,5]]. I made it happen on this repository.

My question corresponds to the following: on my implementation, the cases [[1,2], [3,4]] and [[4,3], [1,2]] may happen because I run the same function recursively with chunks cardinality argument m-1 and remaining points respective to previous blobs.

I have some idea in this direction: the possible m-chunks of k-length on a n-set, such that inequality k*m < n hold, are factorial(n)/(factorial(k)*factorial(n-k)), call it p. which may be storage intensive. In this case, the possible p-chunks may only be arranged in factorial(p)/(factorial(m)*factorial(p-m)).

Because of recursive implementation, I cannot see how to store the values of these combinations in an efficient way. Can you?

0

Browse other questions tagged or ask your own question.