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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Math Programming

Status
Not open for further replies.

VBGuyUsingVC

Programmer
Jan 10, 2002
24
US
I took on a project that I assumed would be relatively simple. But for some reason, there is a block where I cannot find a solution.

I need to write a program that will create all possible combinations of a string. For example:

String = ABC
Combinations=ABC,ACB,BAC,BCA,CAB,CBA

String = ABCD
Combinations=ABCD,ABDC,ACBD,ACDB,ADBC,ADCB,BACD etc....

The string can be any size. I know the longer the string, the greater the combinations. I just cannot seem to figure out how to program it. Go figure. Any help is appreciated.
 
Actually the problem is not that difficult -except that the soloution for any except trivial cases will probably take to long and eventually run out of some resource (memory, disc space, ... patience).

I can't take the time to un-earth any sample code at the moment, I'll try to rember to do it later.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
There is only one combination of the charcters "A", "B" and "C" taken thre at a time.
ABC. What you want is permutations of the characters "A", "B" and "C".

See
Forms/Controls Resizing/Tabbing Control
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top