[Webinar] Streamline your web hosting managementRegister Today

x
Solved

# Getting all possible solutions

Posted on 2008-02-07
Medium Priority
172 Views
Okay, this is for VB6..

What I want to know is how I can get all possible solutions of a set base of letters.

What I would want though, is to be able to 'input' 6 letters and get all the possible solutions and place them in a array. Letters CAN be the same.. For example, Letter 1 = A, Letter 2 = B, Letter 3 = B, Letter 4 = C, Letter 5 = C, Letter 6 = E, some of the results would be

ABBCCE
ABBCEC
ABBECC
ABEBCC
AEBBCC
EABBCC
ABCBCE
ACBBCE
CABBCE
...etc

It doesn't matter if there duplicates however due to the same letter, that's fine by me.. But I was hoping for a simple solution instead of manualy doing each one. Is there any way to get all the solutions? Thanks!
0
Question by:Valleriani
• 3
• 2

LVL 53

Accepted Solution

Infinity08 earned 2000 total points
ID: 20842787
What you want are the permutations of those 6 characters :

http://en.wikipedia.org/wiki/Permutation

There are 6! = 720 different permutations of 6 characters
0

LVL 53

Expert Comment

ID: 20842816
Here's some VB code :

http://www.vbi.org/Items/article.asp?id=133
0

LVL 85

Expert Comment

ID: 20844366
If there are 2 B's and 2 C's the number of permutations would be 6!/(2!2!)
0

LVL 85

Expert Comment

ID: 20844414
0

LVL 53

Expert Comment

ID: 20844482
>> If there are 2 B's and 2 C's the number of permutations would be 6!/(2!2!)

I was following this :

>> It doesn't matter if there duplicates however due to the same letter, that's fine by me..

;)
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Loops Section Overview
###### Suggested Courses
Course of the Month10 days, 11 hours left to enroll