Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2. Bob decides it is not worth his time to delve into cryptocurrency investment and finds an actual job. Alice's bakery has a vandalism problem.
2. Bob decides it is not worth his time to delve into cryptocurrency investment and finds an actual job. Alice's bakery has a vandalism problem. Someone keeps changing her sign to show funny expressions. Bob offers to change the sign back, for a fee. Today, Alice wants bite-crusty-uncles changed back to light-crusts-on-cake. To make this change, Bob considers each letter individually; for each letter, Bob can remove it or replace it with another letter, or Bob can add a new letter. Spaces count as letters. For adding a letter, Bob charges $8. For removing a letter, Bob charges $3. For replacing a letter with a different letter, Bob charges $7. Bob does not charge for leaving letters unchanged. For the first part of the string, Bob planned to make the changes shown on the left and charge $19. Alice found a cheaper matching (shown at right) using dynamic programming bi te. bi te 1 ight- 1 ight 7 0 8 7 7 0 70 88 0 3 0 u - lol I. . She used a two-dimensional array to keep track of the cheapest matches to make. b e r u Sty ncies 1 7 1013 16 19 i 15 7 10 13 16 5 23 15 14 17 20 h31 23 22 21 24 39 31 23 26 28 47 39 31 30 26 B dal | Each entry in the table represents the cheapest way to change the text-up-to-the-column into the text-up-to-the-row. For example, the 30 is the cost of changing bite into light-. The value 18 was determined by considering three possibilities: i. Starting with bite, first change it to light. Then adding - costs $8. This is added to the cost of changing bite to light, which is $?. The total would be $?. ii. Starting with bite, first remove e. This costs $3. Then bit changes to light-, which costs $31. The total would be $34. ii. Starting with bite, replace e with - This costs $7. This is added to the cost of changing bit to light, which is $23. The total would be $30. The cheapest option of the three possibilities is the last, so the table is filled with 30. (a) In iii., $23 was found from the table entry in the row labeled t and column labeled t. What table entry is used to determine the cost of i.? Find the cost of i. (3 points) (b) Describe how to calculate the costs of the three possibilities for general text or for a general location in the table. Be specific about which table entries are used. (6 points) (c) Fill in the rest of the table. What is the minimum cost of changing bite-crusty-uncles to light-crusts-on-cake? (8 points)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started