Results 1 to 2 of 2
Thread: Combinations
- 02-22-2012, 01:01 AM #1
Member
- Join Date
- May 2010
- Posts
- 45
- Rep Power
- 0
Combinations
I am trying to write a program that will write out all of the permutations of some letters. Say I want two letters and two of each letter: AABB. I want to get the 6 different ways to write those (AABB, ABAB, ABBA, BAAB, BABA, BBAA).
My first thoughts were to write a nested for loop with a for loop for each place a letter goes. But this wouldn't scale very well, as I want the program to be able to work for different numbers of letters.
I had some other ideas, but none have gone very far yet. Any suggestions?
Thanks
- 02-22-2012, 07:41 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Re: Combinations
Please don't post the same question multiple times. Stick with a one and if you want to move the thread into a different location please ask from one of our moderators in JavaForums.
I have to close this thread. Stick with the other one where I have post a solution to work around.
Similar Threads
-
Counting the fequency of word combinations
By aianta in forum New To JavaReplies: 1Last Post: 02-19-2012, 08:59 PM -
Combinations in Java
By Roam in forum New To JavaReplies: 12Last Post: 08-25-2011, 10:22 PM -
Possible combinations for a n- digit number???
By anishr6 in forum New To JavaReplies: 4Last Post: 05-25-2011, 08:55 AM -
All possible combinations given a binary number
By LeanA in forum New To JavaReplies: 9Last Post: 06-18-2010, 05:33 PM


LinkBack URL
About LinkBacks

Bookmarks