CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Jumble Solver

  1. #1
    Join Date
    Apr 2011
    Posts
    0

    Jumble Solver

    Hi.

    I need help starting this assignment. The teacher/class is way over my head and I HAVE to do well on this assignment to pass...

    So if anyone could assist me in doing and understanding this assignment, it would be greatly appreciated.

    Thank you!


    ____________________________________________________________________________



    We will write a program to solve word jumbles. You have probably seen them in the newspaper every day. Quick - what word is formed from the letters 'mezia'? 'cidde'? 'hucnah'? 'bouste'? Your program will solve these by brute force. It will have a list of English words (from Program 8, Spell Checker), and it will generate all permutations of the letters in the jumble. When it finds a permutation that is in the word list, its done.

    Requirements

    First, use your WordListIndexed to store the English language dictionary from the Spell Checker program. Our jumbles won't contain any punctuation marks or abbreviations. Don't store them in your WordListIndexed.

    The primary class in this assignment, StringPermutationIterator, generates all the permutations of the letters in a given string. This class must have an iterator interface: next( ) and hasNext( ) (no remove( ) member function). There are two major challenges for this class. First, generate the permutations recursively. For example, to generate the permutations of a four letter string, put one of the four letters as the first letter and combine it will all permutations of the remaining 3 letters. Repeat until each letter has been used at the front (see example). For simplicity, you may assume that all the letters in the input string are unique (no duplications). If this assumption does not hold then we simply generate some duplicates that cause your program to run a little slower. We still get the correct result. Second, you must generate the permutations incrementally. It is not allowed to generate all permutations, store them in a list, and have the iterator walk down the list. Nor is it allowed to utilize the fact that there will be exactly n! permutations. You must create a true dynamic iterator that generates one at a time the elements of the set of permutations. See the general plan for dynamic iterators*.

    Primary classes: StringPermutationIterator.
    Application: Write a short main method that unscrambles the 4 jumbles from the first paragraph of this assignment plus 'ueassrkpc'.

    ____________________________________________________________________________

    See example:

    SPI("cats")
    'c' + an of SPI("ats"). When SPI("ats") rolls over (false == hasNext()), create
    an new nested SPI object
    'a' + an object SPI("cts"). When SPI("cts") rolls over, create a new SPI object
    't' + an object SPI("cas") create SPI("cat")
    's' + an object SPI("cat") When SPI("cat") rolls over, we are done.
    SPI("cats").hasNext() == false




    *
    General plan for dynamic iterators:

    public class DynamicIterator<String>
    implements Iterator<String> {

    String buffer;

    boolean hasNext() { return buffer != null; }

    String next() {
    String result = buffer;
    buffer = createNextElement();
    return result;
    }
    }

  2. #2
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: Jumble Solver

    Sure, what is your question, exactly? What part are you stuck on? what don't you understand? and post up the code you have so far (in CODE tags).

    Being abstract is something profoundly different from being vague... The purpose of abstraction is not to be vague, but to create a new semantic level in which one can be absolutely precise...
    E. Dijkstra
    Please use &#91;CODE]...your code here...&#91;/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  3. #3
    Join Date
    Apr 2011
    Posts
    15

    Re: Jumble Solver

    may i point something out, this has been asked before, and infact dlorde helped, here is the topic

    http://www.codeguru.com/forum/showthread.php?t=487620

  4. #4
    Join Date
    Feb 2021
    Posts
    1

    Re: Jumble Solver

    I think this guy needs to see an example with a jumble solver code? Yes, I have an example in my mind that I can show you from a site that I use to solve my daily jumble puzzles.
    let me know if you have any problems getting help from the jumble solver site. I personally think this is the best example of your code issue.

  5. #5
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Jumble Solver

    Are you sure the OP is still waiting (for almost 10 years!) for your link?
    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured