Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a Word Ladder game in C++ A word ladder (aka doublet) is a type of puzzle created by Charles Dodgson (aka Lewis Carroll) in

Create a Word Ladder game in C++

image text in transcribed

image text in transcribed

A word ladder (aka doublet) is a type of puzzle created by Charles Dodgson (aka Lewis Carroll) in the 1800s. The premise of the puzzle is to "convert" one word into the other by a sequence of single-letter changes, with each change generating a valid English word. For example, you can change beer into wine via the sequence beer - beet - bent -lent - lint - line wine. There may be other ladders for these words as well. Your program should begin by reading words from the file sgb-words.txt: the file consists of 5 757 words used to test the Stanford GraphBase. Note that all words have exactly five letters. Each word should have two values connected to it: A pointer to a word (and its connected data) .A linear list of pointers to other words Initialize the pointer for each word to NULL. Then, examine each pair of words-there are 16568646 such pairs. If the pair has a Hamming distance of 1, then add each word-a pointer to the word actually-to the other word's list Read two five-letter words from the keyboard. Find both words in the word list. If either word is not in the list, stop and output that no word ladder exists. Otherwise, do the following algorithm. A word ladder (aka doublet) is a type of puzzle created by Charles Dodgson (aka Lewis Carroll) in the 1800s. The premise of the puzzle is to "convert" one word into the other by a sequence of single-letter changes, with each change generating a valid English word. For example, you can change beer into wine via the sequence beer - beet - bent -lent - lint - line wine. There may be other ladders for these words as well. Your program should begin by reading words from the file sgb-words.txt: the file consists of 5 757 words used to test the Stanford GraphBase. Note that all words have exactly five letters. Each word should have two values connected to it: A pointer to a word (and its connected data) .A linear list of pointers to other words Initialize the pointer for each word to NULL. Then, examine each pair of words-there are 16568646 such pairs. If the pair has a Hamming distance of 1, then add each word-a pointer to the word actually-to the other word's list Read two five-letter words from the keyboard. Find both words in the word list. If either word is not in the list, stop and output that no word ladder exists. Otherwise, do the following algorithm

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning ASP.NET 2.0 And Databases

Authors: John Kauffman, Bradley Millington

1st Edition

0471781347, 978-0471781349

More Books

Students also viewed these Databases questions