If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > algorithm question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-09-03, 16:53
calculus87 calculus87 is offline
Registered User
 
Join Date: Sep 2003
Posts: 23
algorithm question

I am having a hard time trying to figure out something and was wondering if anyone could point me in the right direction,

ok....say I have x number of attributes
ex. ABCD

How could I write code to find every combination of the 4 letters but no two combinations have the same letters in them.

A,B,C,D,AB,AC,AD,... ABC,BCD...ABCD etc.

and if it has BCD then it won't have CBD.

Also it has to work no matter how many attributes are entered.

Any help would be greatful.


Thanks so much.
__________________
This message is a natural product made from recycled electrons. The slight
variations in spelling and grammar enhance its individual character and
beauty and in no way are to be considered flaws or defects.
Reply With Quote
  #2 (permalink)  
Old 10-17-03, 21:38
sundialsvcs sundialsvcs is offline
Registered User
 
Join Date: Oct 2003
Posts: 706
Lightbulb

This sounds like a homework-problem so I will be vague, but you build up the answer one letter at a time until you reach the desired length, then output, advance to the next letter (or back up a column), and so-on.
...
It's very useful to use the 'set of char' type to remember what characters are already in the solution.
...
The only time that I've seen this IS in a homework problem. Although I never used it in my classes, I know the textbooks we used always had it about chapter-4 or so.
__________________
ChimneySweep(R): fast, automatic
table repair at a click of the
mouse! http://www.sundialservices.com
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On