开发者

How to generate combination of vectors [duplicate]

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜