I have an arbitary vector where I have to try all combinations (sum up different combinations) of elements within the vector. I want to use recursion for this but I have trouble in coding that. I have tried something similar but with a fixed vector size, using for loops. But in this case I cant really use for loops because the vector size can change randomly. How do I integrate this into a recursive algorithm?
Thanks
tspj20
0
Newbie Poster
Recommended Answers
Jump to PostUse the STL perhaps?
http://www.sgi.com/tech/stl/next_permutation.htmlUnless of course using recursion is actually your homework assignment.
All 3 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.