Due: by Wednesday, December 5, 2012 by 11:59pm

Your program listing should have the following information.

# Files: Trees.py, Wordlist.py, Solver.py, README # # Description: # # Student's Name: # # Student's UT EID: # # Course Name: CS 313E # # Date Created: # # Date Last Modified:

- You must submit your .py files.
- Your .py file should have the header with the proper documentation.
- You should be submitting your .py file through the web based
*turnin*program. We will not accept files e-mailed to us. - Your code must compile before submission.

This is the fourth in a series of assignments aimed at solving the Jumbles that you see in the paper or online: Jumble website. The idea is this: given a series of scrambled words, unscramble them.

The basic algorithm is as follows: given a scrambled word (e.g., ACTMH), you generate permutations of the word and check your wordlist until you either find the word (MATCH), or you exhaust the list of permutations, in which case you report failure.

You solved this problem by searching a simple unordered Wordlist in
Assignment 6, a sorted list in Assignment 8, and a hash table in
Assignment 9. In this assignment, you'll be building on what you did
in Assignment 8. **Be sure to use the code from Assignment 8, not
from Assignment 9.**

Feel free to update your code from Assignment 8 as you see fit. But
you should have to change very little in your Solver module to make
this work. You should strive to have very
minimal changes to your Solver file. You really are only changing the
implementation of your `Wordlist` class. However, for this
assignment, you don't have to do any of the command line processing
you did in Assignment 8, so you can remove that code.

Implement the steps below.

You __init__ function in the new class should look like this:

def __init__(self): Wordlist.__init__( self ) self._wordtree = Trees.BinarySearchTree()That is, you're adding a new data item, which is a BinarySearchTree. It should have available all of the functions on a binary search tree.

You will build your wordlist by inserting each word (of the correct
length) into the binary
search tree Method `findWord` should
search for the presence of a string in the tree using the inTree
method from the BinarySearchTree class. You can return the number of
comparisons for each search using the nodeDepth method from the
BinarySearchTree class.

*The interface for BinaryTreeWordList should be exactly the same as the
interface for WordList. That is, the user of the class should not see
any difference.*

Then, populate your wordlist (tree) as before with the words from file: Unordered word list, filtering to store only words of 5 or 6 letters. As in earlier assignments, print out the number of words in the wordlist and how long it took to generate the wordlist.

Following that initial setup, your main program should do exactly what it did in earlier assignments: Enter a loop and in each iteration prompt the user for an input string, generate permutations of the string, and test whether any permutation is in the wordlist. If so, return that word as your answer along with statistics of the search (how many comparisons you made, how many permutations were tried, and how long it took). If no permutation is in the wordlist, report failure and the statistics of the search. Loop until the user enters "exit." User input should not be case sensitive. The output should be very nearly identical to that from Assignment 6.

felix:> python Solver.py tree Using binary tree wordlist. Creating wordlist The Wordlist contains 22633 words. Building the Wordlist took 1.741 seconds Enter a scrambled word (or EXIT): seyzt Found 120 permutations; 120.0 unique permutations Found word: zesty Solving this jumble took 0.00590 seconds Checked 48 permutations. Made 776 comparisons. Enter a scrambled word (or EXIT): chitk Found 120 permutations; 120.0 unique permutations Found word: thick Solving this jumble took 0.00459 seconds Checked 29 permutations. Made 636 comparisons. Enter a scrambled word (or EXIT): daciev Found 720 permutations; 720.0 unique permutations Found word: advice Solving this jumble took 0.08427 seconds Checked 542 permutations. Made 10759 comparisons. Enter a scrambled word (or EXIT): nimleg Found 720 permutations; 720.0 unique permutations Found word: mingle Solving this jumble took 0.07916 seconds Checked 489 permutations. Made 10596 comparisons. Enter a scrambled word (or EXIT): torll Found 120 permutations; 60.0 unique permutations Found word: troll Solving this jumble took 0.00105 seconds Checked 6 permutations. Made 124 comparisons. Enter a scrambled word (or EXIT): exit Thanks for playing! Goodbye. felix:~/cs313e/python/newjumble>