Question: Could you solve this problem ASAP? It's urgent. Problem 5. (27 points) Consider the following problem to deal with chemical compound names, where we are
Could you solve this problem ASAP? It's urgent.

Problem 5. (27 points) Consider the following problem to deal with chemical compound names, where we are given a dictionary D contained of words, and also a query word O. We are interested in whether the word can be made up by con- catenating words from D (potentially using the same word multiple times.) For ex- ample, if D={a, ne, poly, oct, ol, ane) and the word -octane, , then the answer should be Yes, because octane can be made up of words from D (it can be made in 2 ways in fact: oct. a ne and oct|ane). On the other hand, for the word O-polyanoct the answer is No, as it can not be made from the words from D. (a) As we learned in class, in order to solve problems using dynamic program- ming, we need to find recursive subproblems that repeat themselves in the "ordinary" recursive solution. Describe precisely and concisely what are those recursive subproblems and the recursive formulation that would yield the solution? (b) Use your previous answer to say what data structure you would use to store the answers to subproblems using dynamic programming approach and how you would compute each cell? Use words or pseudocode or code. Show your answer on the example with the dictionary given above and word octane
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
