0

I want to ask if someone has already have an article or working algorithm where it can get all the combination possible in a given word.

Example: "ABCD"
possible combinations or arrangement without duplicates:
"ABCD"
"ABC"
"ABD"
"BCD"
"AB"
"AC"
"AD"
"BC"
"CA" <--- is the same as "AC"
"CBA" <--- is the same as "ABC" or "BCA"
"BD"

3
Contributors
6
Replies
7
Views
8 Years
Discussion Span
Last Post by ddanbe
0

If you sorted them into alphabetical order you'd be able to tell if they were the same or not.

eg

ABA gets sorted to AAB

0

To find all the combinations of say words of 3 letters from a word of 4 cannot be that difficult. To exclude the "identicals" I would sum their ASCII-char values of a word and test if they are the same.

0

That might not necessarily work.

AED would = BCF

33+37+36 = 106
34+35+37 = 106

Only true way is to sort them and compare them.

0

You are quite right LizR! The minute I sent it I knew I was wrong.
But btw. your example to prove it looks a little weird(ASCII code for A=65,B=66 etc.)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.