{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lab_003 - Homework Assignment 4 Word Ladder Overview stone...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Homework Assignment 4 Word Ladder Overview: stone A tone a L one C lone clon S c O ons co N ns con E s cone Y M oney Word ladders were invented by Lewis Carroll in 1878, the author of Alice in Wonderland . A ladder is a sequence of words that starts at the starting word, ends at the ending word, In a word ladder puzzle you have to change one word into another by altering a single letter at each step. Each word in the ladder must be a valid English word, and must have the same length. For example, to turn stone into money , one possible ladder is given on the left. Many ladder puzzles have more than one possible solutions. Your program must determine a shortest word ladder. Another path from stone to money is stone store shore chore choke choky cooky cooey coney money Objectives Practice implementing and using a Queue data structure. Gain an understanding of algorithms used for efficient implementation. Practice working in small teams to solve problems, design algorithms and write code Instructions Your program will accept starting and ending words from the input file called "input.txt". Then, you read the dictionary file from the course web page at http://www.andrew.cmu.edu/course/15- 121/dictionary.txt using the URL class and store it in a HashSet . Finally, you build a word ladder between starting and ending words There are several ways to solve this problem. One simple method involves using stacks and queues. The algorithm (that you must implement) works as it follows Get the starting word and search through the dictionary to find all words that are one letter different. Create stacks for each of these words, containing the starting word (pushed first) and the word that is one letter different. Enqueue each of these stacks into a queue. This will create a
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern