1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
miskamm [114]
3 years ago
8

Given a non-empty string s and a dictionary containing a list of unique words, design a dynamic programming algorithm to determi

ne if s can be segmented into a space-separated sequence of one or more dictionary words. if s="algorithmdesign" and your dictionary contains "algorithm" and "design". your algorithm should answer yes as s can be segmented as "algorithmdesign

English
1 answer:
nlexa [21]3 years ago
8 0
Let s(i),k denote the substring s(i)s(i+1)...s k. Let Opt(k) denote whether the sub-string s1,k can be segmented using the words in the dictionary, namely (k) =1 if the segmentation is possible and 0 otherwise. A segmentation of this sub-string s1,k is possible if only the last word (say si  k) is in the dictionary theremaining substring s1,i can be segmented. 
Therefore, we have equation:Opt(k) =                    max                       Opt(i)          0<i<k and s(i+1),kis a word in the dictionary
We can begin solving the above recurrence with the initial condition that Opt(0) =1 and then go on to comput eOpt(k) for k= 1, 2. The answer correspond-ing to Opt(n) is the solution and can be computed in Θ(n2) time.

You might be interested in
Change the 6 present tense verbs to the past tense.
ryzh [129]

Answer:

The computer worked fine until I began playing music through it. Then it slowed down to a halt and froze. It was really frustrating. I just wanted it to work!

Explanation:

This is what we need to know about the Simple Past Tense to answer this question.

1. The verb to be presents two forms in the past: was and were. The form was is used for the persons I, he, she, and it. Were is used for the rest.

2. Regular verbs in the past will have -d, -ed, or -ied added to their ending. The ones that end in e receive -d. The ones that end in consonant + y drop the -y and receive -ied. And the rest receives -ed.

3. Irregular verbs in the past have each a different form. There isn't much we can do but memorize them. For example: begin - began; freeze - froze; go - went; speak - spoke.

4 0
3 years ago
If a person degenerates would you say they are progressing or regressing? Explain (30 points)
gtnhenbr [62]

Answer: regressing

Explanation: if a person degenerates, they are losing capabilities and their qualities are decreasing or declining. Basically things are getting worse.

Regressing is returning to an older, less developed state while progressing is getting better.

Degenerating and regressing are going backward while progressing is going forward.

3 0
3 years ago
which sentence from the Declaration of Independence best develops the idea that King George 3 abused his executive powers in rel
qaws [65]
Answer Expert Verified. The correct answer is C. He has refused his Assent to Laws, most wholesome and necessary for the public good. He explains that the King does not abide by the laws he himself set and that works against the good of the colonies, which is why they must depose him.
3 0
3 years ago
Make a paragraph add two dependent clauses, and<br> two phrases
Veronika [31]

Answer:

The little girl ran to her Mummy, because the dog was there' is a multi-clause sentence ( the main clause is 'the little girl ran to her Mummy', and the subordinate clause is 'because the dog was there').

Explanation:

7 0
3 years ago
Which type of pronoun is used in this sentence?
kiruha [24]

Answer:

b

Explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • According to the word history, sabotage comes from the name of (1 point) a French king. an early type of machine. a secret organ
    10·1 answer
  • The family purchased hot chocolate and cookies for the upcoming snowstorm<br> A for <br> B the
    14·1 answer
  • The narrator of the frame story in the canterbury tales is __________________.
    10·2 answers
  • Read the sentence.
    5·1 answer
  • Is it a phrase or a clause
    6·1 answer
  • What is the definition of exposition?
    14·2 answers
  • To exacerbate the problem mean? (A). To reduce the problem (B). To increase the severity (C). The problem is unclear (D). To fin
    6·1 answer
  • What type of figurative language does this show?
    11·2 answers
  • What's the first thing you need to do to prepare for an exam?
    14·2 answers
  • I kneed help pls solve this
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!