Solved

Rearranging the letter

Posted on 2011-10-28
Medium Priority
1,330 Views
How many different strings can be formed by rearranging the letters in the word ABABA ? Thanks.

I guess its a combination not permutation because it dont say anything about order

5!
but how to i put into the formula as i need 2 numbers
C(n,r)=n!/r!(n-r)!
0
Question by:mustish1

LVL 10

Expert Comment

ID: 37045793
5! / 3
0

LVL 18

Accepted Solution

Garry Glendown earned 500 total points
ID: 37045809
With the limited number of different symbols available, you could see this as a 2 out of 5 code ... as all the "A" symbols can't be seen as "different", nor the "B" symbols. The formula you posted is dead-on, with n being the number of places, r being the number of one symbol, and obviously n-r the number of the other symbol. This formula of course only applies to the target string being made up of two different symbols.
For more than two different symbols, divide n! by the product of the factorials of the occurrences of the different symbols.
0

LVL 10

Assisted Solution

abbright earned 500 total points
ID: 37045810
There are 5! possibilities to arrange 5 letters.
There are 3! options to arrange the 3 As, and 2! to arrange the 2 Bs.
So theres 5!/(3!*2!) options for ABABA.
so: n=5, r=3 or 2 as 5-3=2 and 5-2=3
The result is 10.
0

LVL 14

Expert Comment

ID: 37045813
Looks like 8 to me.  I could write this out as a short program, but not sure a way to put it into a straight math formula.   The difficulty comes in that you have repeating letters, thus have to eliminate the duplicate permutations.

ABABA
BAABA
BAAAB
ABAAB
AABAB
AAABB
BBAAA
BABAA
0

LVL 74

Assisted Solution

sdstuber earned 500 total points
ID: 37045819
as in your previous question "strings" implies ordering

this one is tricky because you have repeated characters.  the answer is different than if it were ABCDEF, because as you rearrange them two A's or two B's are indistinguisable.
So it's not just a combination or permutation.

In this case it's probably easiest to just list them all

AAABB
AABAB
AABBA
ABAAB
ABABA
ABBAA
BAAAB
BAABA
BABAA
BBAAA
0

LVL 27

Assisted Solution

d-glitch earned 500 total points
ID: 37045823
It is permutation, because order matters in strings.
And note that it doesn't say anything about length:   A  AA AAA are all possible strings.

This is a different sort of problem.
0

LVL 18

Expert Comment

ID: 37045824
P.S. - these are the possible solutions:
``````aaabb
aabab
aabba
abaab
ababa
abbaa
baaab
baaba
babaa
bbaaa
``````
0

LVL 14

Expert Comment

ID: 37045839
Ah, I missed 2 of them in my brute-force method.  Curses! :)
0

Featured Post

Question has a verified solution.

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

This article provides a brief introduction to tissue engineering, the process by which organs can be grown artificially. It covers the problems with organ transplants, the tissue engineering process, and the current successes and problems of the tec…
An introduction to the wonderful sport of Scam Baiting.  Learn how to help fight scammers by beating them at their own game. This great pass time helps the world, while providing an endless source of entertainment. Enjoy!
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Suggested Courses
Course of the Month8 days, 15 hours left to enroll