December 15th, 2004, 07:39 PM
if i had this string "a,b,c,d,d"
how could i write code so that i could find all the possible combinations of the letters in this string?
December 24th, 2004, 11:06 PM
hmm, I'm sure this isn't the best way, but what about mapping numbers to the letters, then generating random numbers (which could be turned into the letters) and saving each try in a TStringList or something, and maybe if it didn't get a new combo after 20 tries or so, it could be done. What do you guys think?
December 25th, 2004, 12:51 AM
Are you maybe looking for permutation algorithms?
Originally Posted by room24
Is this your homework?
December 25th, 2004, 11:08 AM
December 25th, 2004, 11:56 AM
It's a brute force approach, but using random numbers makes it very fragile and unreliable. Short: No, it would not work.
Originally Posted by HappyDev