Results 1 to 2 of 2

Thread: Combinations

  1. #1
    atomant is offline Member
    Join Date
    May 2010
    Rep Power

    Default 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?


  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Colombo, Sri Lanka
    Blog Entries
    Rep Power

    Default 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

  1. Counting the fequency of word combinations
    By aianta in forum New To Java
    Replies: 1
    Last Post: 02-19-2012, 08:59 PM
  2. Combinations in Java
    By Roam in forum New To Java
    Replies: 12
    Last Post: 08-25-2011, 10:22 PM
  3. Possible combinations for a n- digit number???
    By anishr6 in forum New To Java
    Replies: 4
    Last Post: 05-25-2011, 08:55 AM
  4. All possible combinations given a binary number
    By LeanA in forum New To Java
    Replies: 9
    Last Post: 06-18-2010, 05:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts