Give an algorithm to determine whether a word a can be


Question: Modify Exercise to allow words of arbitrary length and to allow transformations in which we add or delete one character. The cost of adding or deleting a character equals the length of the longer string in the transformation while a single-character substitution only costs 1. Thus ark, ask, as, was is a valid transformation from ark to was and the cost is 7 (1+3+3).

Exercise: A word can be changed to another word by a one-character substitution. Assume that a dictionary of five-letter words exists. Give an algorithm to determine whether a word A can be transformed to a word B by a series of one-character substitutions, and if so, outputs the corresponding sequence of words. For example, bleed converts to blood by the sequence bleed, blend, blond, blood.

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Give an algorithm to determine whether a word a can be
Reference No:- TGS02462459

Now Priced at $20 (50% Discount)

Recommended (97%)

Rated (4.9/5)