Unscrambling word Program help

  • Thread starter Hybr!d
  • Start date
  • Tags
    Program
In summary: Here's the code:char wordlist[];char alpha[];wordlist = "all, some, small, sine";alpha = {0x0};for(int i = 0; i < strlen(wordlist); i++){alpha[i] = wordlist[i];}printf("%s", alpha);alpha[4][10] = {0x0};for(int i = 0; i < strlen(wordlist); i++){alpha[i] = wordlist[i];}printf("%s", alpha
  • #1
Hybr!d
18
0
Hello Guys.

I was wondering how would you go around making an application that unjumbles words. It uses a wordlist and extracts the unjumbled word like.

jumbled: ial
unjumbled:ali

I hope somone got an idea. Thanx
 
Technology news on Phys.org
  • #2
Here is a start in C:

word list:
Code:
char wordlist[4][8]={"all", "some", "small", "sine"};
char alpha[4][10]={0x0};


wordlist has four elements: each word we know how to unscramble
alpha is an alphabetically arranged set of characters from wordlist:
wordlist alpha
all all
some emos
small allms
sine eins

The algorithm is:
Code:
input a scrambled word
lowercase all the letters in the word
alphabetize the letters in the scrambled (just like we did for "alpha" above)
search thru each element of alpha to find an exact match
print the corresponding element in wordlist -
  i.e., if you find an exact match with "emos" print "some"
  else printf "not found in list"
 
  • #3
mcnamara's onto a good start, but don't try to store all those words in memory!

First, sort the letters in the target word. Read the words from the word list (a text file) one at a time, sort the characters, and compare with the sorted target word.

- Warren
 
  • #4
An even faster way would be to count the letters in the word and add up the ordinal of all the letters (1=a, 2=b, etc.). Then match the number of letters and total ordinal sum against your word list (where you've already computed these two numbers for each word, and sorted numerically), and then try permutations of your test word against the matched words from your word list. Should take the search from order(N) down to order(log[N]) or less, I would think...
 
  • #5
berkeman,

There are a ton of different ways one could optimize this for run-time performance, particularly by storing pre-computations like the one you described.

- Warren
 
  • #6
Thanx guys. I got a start
 

1. What is an "Unscrambling word Program"?

An Unscrambling word Program is a computer program that takes in a scrambled word as input and provides a list of possible words that can be formed from the given letters as output.

2. How does an Unscrambling word Program work?

The program uses various algorithms and databases to analyze the given word and generate a list of all possible combinations of letters. It then checks the generated combinations against a dictionary to determine which ones are actual words and presents them as the final output.

3. Can an Unscrambling word Program help with any word?

Yes, most Unscrambling word Programs are designed to work with any word, as long as it contains at least two letters. However, some programs may have limitations based on the length of the word or the number of possible combinations.

4. Are there any tips for using an Unscrambling word Program effectively?

One helpful tip is to provide the program with a partial or complete set of letters to narrow down the search and get more accurate results. Also, using a program with a larger database and more advanced algorithms can improve the accuracy and speed of results.

5. Can an Unscrambling word Program be used for cheating in games like Scrabble?

While an Unscrambling word Program can certainly help in solving word puzzles and games, it is not ethical to use it for cheating. It is important to use such programs responsibly and for educational or personal purposes only.

Similar threads

  • Programming and Computer Science
Replies
7
Views
455
  • Programming and Computer Science
Replies
22
Views
912
  • Programming and Computer Science
2
Replies
69
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
1K
  • Programming and Computer Science
2
Replies
37
Views
2K
  • Programming and Computer Science
Replies
8
Views
873
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
32
Views
5K
  • Programming and Computer Science
Replies
22
Views
9K
  • Programming and Computer Science
Replies
6
Views
2K
Back
Top