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.
4 Respuestas
+ 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++
+ 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
0
thanks but how do I go about it
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