combination without repetition of N elements without use for..to..do

前端 未结 6 1206
野的像风
野的像风 2020-12-29 11:08

i want load in a list the combination of N number without repetition, giving to input the elements and group. For example, with 4 elements [1,2,3,4], i have for:

<         


        
6条回答
  •  温柔的废话
    2020-12-29 11:44

    Following the link that David posted and clicking around led me to an article where they coin the term "Banker's Search", which seems to fit your pattern.

    The article provides an example solution in C++, utilizing recursion:

    Efficiently Enumerating the Subsets of a Set

提交回复
热议问题