Can't get my mind wrapped around simple permutations

C

comp.unix.shell

I'm trying to get the permutation of every element in a vector<float>
I've looked at using <algorithm> and some of its examples, but the
examples I saw do all permutations of every item in t eh list. It
uses all elements in every permutation.
I've tried several attempts of recursion and some goto's withou
recursion.
The list length is 1..N
An example list (using chars for readibility
A B C D
I would be looking for
A
AB
ABC
ABCD
AC
ACD
AD
B
BC
BCD
BD
C
CD
D
 
M

Martin York

I'm trying to get the permutation of every element in a vector<float>

Your basic concept of permutation is wrong:

Permutations of the vector ABCD are:

ABCD
ABDC
ACBD
ACDB
etc....

PS. Read the docs of the STL algorithms there will be some help in
there.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top