开发者

How to generate combination of vectors [duplicate]

开发者 https://www.devze.com 2023-02-15 05:43 出处:网络
This question already has answers here: 开发者_如何学Go Closed 11 years ago. Possible Duplicate: combination and permutation in C++
This question already has answers here: 开发者_如何学Go Closed 11 years ago.

Possible Duplicate:

combination and permutation in C++

I have a vector of say size "n". Lets say for example a vector of n=4, <1,2,3,4>. How can I generate all n-1 combinations of this vector. In this example, 4 chose 3. I want the output to be <1,2,3> <1,2,4> <1,3,4> <2,3,4>. Thanks.


Start by looking up STL's next_permutation function.

0

精彩评论

暂无评论...
验证码 换一张
取 消