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. Advertisements

  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. Advertisements

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,644
    Bob Jenkins
    May 10, 2004
  2. GrantMagic

    Breaking URL character combinations

    GrantMagic, Oct 22, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    549
    bruce barker
    Oct 22, 2004
  3. suzy

    comparing combinations

    suzy, Feb 8, 2004, in forum: Java
    Replies:
    2
    Views:
    423
  4. Thomas Hawtin

    type combinations

    Thomas Hawtin, Apr 29, 2006, in forum: Java
    Replies:
    3
    Views:
    458
    Stefan Ram
    Apr 29, 2006
  5. Stefan Ram

    type combinations

    Stefan Ram, Apr 29, 2006, in forum: Java
    Replies:
    0
    Views:
    370
    Stefan Ram
    Apr 29, 2006
  6. jose luis fernandez diaz

    Combinations/permutations algorithm in C++

    jose luis fernandez diaz, Apr 13, 2004, in forum: C++
    Replies:
    6
    Views:
    14,450
    Leor Zolman
    Apr 13, 2004
  7. raghu

    combinations of a string

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

    Method to get string combinations

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