Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > combinations of a string ?

Reply
Thread Tools

combinations of a string ?

 
 
M a n i s h
Guest
Posts: n/a
 
      10-20-2003
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.
 
Reply With Quote
 
 
 
 
Thomas Matthews
Guest
Posts: n/a
 
      10-20-2003
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Method to get string combinations Christoph Blank Ruby 8 02-12-2009 09:54 AM
combinations of a string raghu C Programming 1 01-04-2007 04:20 PM
millions combinations of test vectors for ALU Lily VHDL 16 05-10-2004 07:22 PM
Re: 70-292 Combinations Tom Helms [MSFT] MCSE 1 02-29-2004 01:44 PM
MCSE 2000 exam combinations TheXman MCSE 1 12-05-2003 01:27 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57