Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. 6 points Implement a program to play the word Ladser gamt by completing the functions in wordLaddorstartry.oNote: you'll also need these files basicgraphugy.bfsigy, and

image text in transcribed
image text in transcribed
1. 6 points Implement a program to play the word Ladser gamt by completing the functions in wordLaddorstartry.oNote: you'll also need these files basicgraphugy.bfsigy, and quesuel210upy since wordLadderStart imports them) Given a start word and end" word.the word Ladder game finds a sequence of intermediate words that transforms the start word to end word, with the condition that each word in the sequence differs in exactly one letter (at one position) from the prior and subsequent words. Thus, for "adore" and "scorn" a ladder is: adore adom acorn scorn And for "white" to "black" a ladder is: white whine shine swine swing sling cling clink blink blank black For "arise" to 'sleep" the shortest ladder has 14 intermediate words Can you find them? The wordladder program takes one optional argument, the name of a text file containing the word list to be considered. You may assume all words in the dictionary are five letters long. all lower case. Each word appears on a separate line in the file. A test file with a few thousand five-letter words is here: wordsStest.NOTE: Test your code first on a file with just a few words before running your program on words5 text; debugging will be easier Your program should first read the word list and build a corre graph. The graph will have one vertex for cach word, and an edge between nodes whose words differ in exactly letter sponding After building the graph, the program should enter a loop that repeatedly asks the user to provide start and end words. and finds (f one exists) the shortest word ladder from the start word to the end word printing the sequence of words found (or an appropriate message if no such sequence exists). Note: if you finish this early, here's something extra you can do for fun. Modif your algorithm to try to find long word ladders rather than short ones, Eg. can you find a ladder from black try this that's longerthan steps? Longer than 6 seep? Hint even just "wiching the graph traversal algorithm from bf's to dfs often gives you fairly long ladders it's supereasy to

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

Online Systems For Physicians And Medical Professionals How To Use And Access Databases

Authors: Harley Bjelland

1st Edition

1878487442, 9781878487445

More Books

Students also viewed these Databases questions

Question

=+country competitive advantages? Why? Support your point of view.

Answered: 1 week ago