0

Permutation program

I want to write a program in c++ that will bring out all possible words that can be formed from a given set of letters. I tried using Rand but it always repeat the letters and does not bring all the possible outcomes. please guys I need your help. love you all.

20th May 2018, 6:47 AM
Anthony Peter
Anthony Peter - avatar
4 Réponses
+ 2
Google the permutations algorithm, understand how it works, code it for testing, and then code checking of a given generated sequence against a dictionary file to see if the sequence is a word of an natural language. check also if any online dictionaries provide APIs to do checks over the internet, but this for sure will last longer then a local dictionary checking. that's it. I am sure you'll find permutation already coded in c++
27th May 2018, 2:47 PM
Skipper
Skipper - avatar
+ 2
Using a pseudo random generator is wrong since it will never exhaust all permutations in reasonable timeframe. moreover it may repeat a sequence already checked hence waste of time. I'd suggest picking a simple brute Force algorithm and check every permutation against an off line dictionary - much faster then in case of an online dictionary. good luck
26th May 2018, 10:17 AM
Skipper
Skipper - avatar
0
thanks but how do I go about it
27th May 2018, 9:27 AM
Anthony Peter
Anthony Peter - avatar
0
include <ctime> include <"The random one"(i forgot now)"> using namespace std; int main (){ srand(ctime (0) cout << rand() It will generate a random number
16th Aug 2018, 9:42 PM
I Am Arthur
I Am Arthur - avatar