Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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 $29. Alice found a cheaper matching (shown at right) using dynamic programming. bl7ii0g8th7et70bl7ii0g8h8tt0e30 She used a two-dimensional array to keep track of the cheapest matches to make. Part of the array is shown below, with some entries filled in. 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 30 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. iii. 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)
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