Results 1 to 3 of 3

Math Help - anagrams

  1. #1
    Member
    Joined
    Jan 2008
    Posts
    154

    anagrams

    I am trying to implement an algorithm that finds all the anagrams (permutations) of a string of letters.

    My thinking: Do it by alphabetical order.

    So abc, acb, bac, bca, cab, cba

    1. Sort strings by alphabetical order.
    2. Swap other 2 letters in each string in the case of n = 3.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Banned
    Joined
    Nov 2007
    Posts
    54

    Does that mean you are writing computer code or just trying to find an algorithm

    to methodically listing permuations and combinations by hand?

    There usually is little difference in the algorithm but I wonder about its purpose.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Member
    Joined
    Jan 2008
    Posts
    154
    I am trying to find an algorithm.

    Here is what I though of:

    In the case of abc:

    1. Fix first letter. Swap the second two letters.

    2. Swap first two elements. Fix first element. Now swap second two letters.

    3. Swap first and last elements. Fix first element. Now swap second two letters.

    etc..
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. [SOLVED] anagrams
    Posted in the Discrete Math Forum
    Replies: 3
    Last Post: April 1st 2010, 03:38 PM
  2. Anagrams
    Posted in the Math Puzzles Forum
    Replies: 14
    Last Post: March 16th 2010, 12:06 AM
  3. Anagrams 2
    Posted in the Math Puzzles Forum
    Replies: 7
    Last Post: March 15th 2010, 11:56 PM
  4. Combinations (Anagrams)
    Posted in the Discrete Math Forum
    Replies: 5
    Last Post: January 29th 2010, 10:11 AM
  5. Anagrams to remember formulas?
    Posted in the Algebra Forum
    Replies: 0
    Last Post: February 22nd 2009, 09:17 PM

Search Tags


/mathhelpforum @mathhelpforum