combinations of a string ?

Discussion in 'C Programming' started by M a n i s h, Oct 20, 2003.

  1. M a n i s h

    M a n i s h Guest

    i have been trying to build a program to find various combinations of a string.
    the problem is that if there are multiple similar characters in the string
    then the program displays multiple similar combinations. how could i overcome
    this ...comparing each o/p doesn't seem feasible.
    M a n i s h, Oct 20, 2003
    #1
    1. Advertising

  2. M a n i s h wrote:
    > i have been trying to build a program to find various combinations of a string.
    > the problem is that if there are multiple similar characters in the string
    > then the program displays multiple similar combinations. how could i overcome
    > this ...comparing each o/p doesn't seem feasible.


    This is more of a programming issue than a C language issue.
    Next time, C language issues are answered in this newsgroup,
    general programming issues in news:comp.programming.

    Although your requirements are a bit vague, try creating a
    set of all the characters in the string (the set should
    allowing only unique characters). Next, generate
    combinations of all the letters in the set.

    As for duplicate letters, you may want to make the elements
    in your set like <letter, quantity>. The quantity will
    let you know how many times you can repeat a letter.

    As far as repeating goes, you may want to stick in some
    advanced rules which filter out unused combinations of
    letters, such as "ttt" or "eee". But this depends on
    you language.

    --
    Thomas Matthews

    C++ newsgroup welcome message:
    http://www.slack.net/~shiva/welcome.txt
    C++ Faq: http://www.parashift.com/c -faq-lite
    C Faq: http://www.eskimo.com/~scs/c-faq/top.html
    alt.comp.lang.learn.c-c++ faq:
    http://www.raos.demon.uk/acllc-c /faq.html
    Other sites:
    http://www.josuttis.com -- C++ STL Library book
    http://www.sgi.com/tech/stl -- Standard Template Library
    Thomas Matthews, Oct 20, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lily
    Replies:
    16
    Views:
    1,309
    Bob Jenkins
    May 10, 2004
  2. GrantMagic

    Breaking URL character combinations

    GrantMagic, Oct 22, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    410
    bruce barker
    Oct 22, 2004
  3. Roedy Green

    Re: combinations

    Roedy Green, Jul 30, 2003, in forum: Java
    Replies:
    0
    Views:
    390
    Roedy Green
    Jul 30, 2003
  4. raghu

    combinations of a string

    raghu, Jan 4, 2007, in forum: C Programming
    Replies:
    1
    Views:
    268
    santosh
    Jan 4, 2007
  5. Christoph Blank

    Method to get string combinations

    Christoph Blank, Feb 11, 2009, in forum: Ruby
    Replies:
    8
    Views:
    94
    Giampiero Zanchi
    Feb 12, 2009
Loading...

Share This Page