[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Getting all possible solutions

Posted on 2008-02-07
5
Medium Priority
?
172 Views
Last Modified: 2010-04-30
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
Comment
Question by:Valleriani
  • 3
  • 2
5 Comments
 
LVL 53

Accepted Solution

by:
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

by:Infinity08
ID: 20842816
Here's some VB code :

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

Expert Comment

by:ozo
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

by:ozo
ID: 20844414
0
 
LVL 53

Expert Comment

by:Infinity08
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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

612 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question