Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Algorithm to generate sequences

Status
Not open for further replies.

tabaki

Programmer
Nov 14, 2001
19
BE
I have a row of elements (in this case numbers)
example: 1 - 3 - 3 - 2

I want to create an algorithm that generates each sequence:
1-3-3-2
1-3-2-3
1-2-3-3
...

Does some one has an idea?

1 remarque: 3-1-2-3 and 3-1-2-3 or the same sequences for me, even though the first "3" is replaced with the last one.

 
What you are looking for is called "permutation".
Here's a link to some code that should get you started:

Cheers,
MakeItSo

“Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family.” (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top