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.
精彩评论