Thread: Permutation of characters

  1. #1
    Registered User
    Join Date
    Oct 2006

    Permutation of characters

    can anyone suggest some method to show all the permutation of a set of characters 1)recursively, and
    2)non-recursively but using stack operation

    and i can't use any pre-set function of C++

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #3
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    1 - Grab a bunch of magazines, put them in a pile. You have your first permutation.
    2 - Move the magazines to another pile by only touching the top magazine. You have your second permutation.
    3 - Now, create another pile by touching only the top magazine, but put the first aside and only move to the new pile in the end. You have your third permutation.
    4 - Repeat 3 as many times as magazines you have - 1 time (you already did that one). You have a bunch of new permutations.
    5 - Repeat 3 but this time it is the second magazine that you move aside.
    6 - Do 4 again for the second magazine.
    repeat 5 and 6 until after you moved aside the last magazine. You have all permutations. ( I think. If you have more, you will find out as you try this test and correct my logic. It's also part of the learning process. Good on you)

    Translate that to code.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A development process
    By Noir in forum C Programming
    Replies: 37
    Last Post: 07-10-2011, 10:39 PM
  2. HELP!!!!emergency Problem~expert please help
    By unknowppl in forum C++ Programming
    Replies: 9
    Last Post: 08-21-2008, 06:41 PM
  3. Replies: 10
    Last Post: 07-10-2008, 03:45 PM
  4. How do you check how many characters a user has entered?
    By engstudent363 in forum C Programming
    Replies: 5
    Last Post: 04-08-2008, 06:05 AM
  5. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 04:54 PM