Thread: permutations of a string

  1. #1
    Registered User
    Join Date
    Oct 2005
    Hyderabad, India

    permutations of a string

    how do you print all the permutations of a string when:
    1)assume all characters are distinct .
    2)can have duplicate characters

    i know how to do it recursively:
    example string is abc
    permutations are:
    a + (permutations of bc)
    b + (permutations of ac)
    c + (permutations of ab)

    ne better way ?

  2. #2
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Your way seems fine.
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. char Handling, probably typical newbie stuff
    By Neolyth in forum C Programming
    Replies: 16
    Last Post: 06-21-2009, 04:05 AM
  2. Inheritance Hierarchy for a Package class
    By twickre in forum C++ Programming
    Replies: 7
    Last Post: 12-08-2007, 04:13 PM
  3. RicBot
    By John_ in forum C++ Programming
    Replies: 8
    Last Post: 06-13-2006, 06:52 PM
  4. Classes inheretance problem...
    By NANO in forum C++ Programming
    Replies: 12
    Last Post: 12-09-2002, 03:23 PM
  5. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 06:49 PM