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.progr amming.
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.l earn.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