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
2
ivanzaharov [21]
A. All spiders are creepy.
C. Every artist is fascinating.
E. Video games are all awesome.
6 0
3 years ago
What is the difference between a monologue and a soliloquy.
SVEN [57.7K]
The difference between a monologue and a soliloquy is that in a soliloquy, the speaker is not addressing anyone. While a monologue may be addressed to someone. Thank you for posting your question. I hope this answer helped you. Let me know if you need more help. 
8 0
3 years ago
The past, the Kota spoke to the bones of their ancestors before making important decisions. They stored the bones in small baske
Mamont248 [21]

Answer:

I think its B

Explanation: Not completly sure

8 0
2 years ago
Think about a delicious and nutritious food like khichuri or pudding or firni. Ask some questions to your mother about its resip
Ludmilka [50]
<h2>Answer:</h2><h2>I thought of pudding.</h2><h2>I asked some questions about it from mummy and here was her response:</h2><h2>combine sugar cornstarch and salt.</h2><h2>And stir in milk.</h2><h2>Stir till mixture thickens.</h2><h2>Pour into mould and let it chill until firm.</h2><h2>We tried to prepare:our family and I. Consisting of the cook, helping hand and food hyper.</h2><h2>recipe for custard: Whip eggs sugar and cornstarch together in a bowl till sugar dissolves.</h2><h2>Set saucepan on a low heat.</h2><h2>Pour in egg mixture slowly and whisking constantly until custard thickens.</h2><h2>for calcuim and proteins as it contains milk .</h2>

<h2> </h2>

4 0
3 years ago
What can you conclude was Swift's purpose in suggesting such a horrible solution?
Alona [7]

Answer:

Swift's purpose is to shock his readers with his very "immodest"

proposal. In Ireland at this time, there is extreme poverty,

overpopulation, and an unfair balance of trade with Great Britain.

He suggests that the Irish should sell their children as food to

reduce the overpopulation and poverty.

Explanation:

i don't know if this is a good answer

8 0
3 years ago
Other questions:
  • In which sentence does the prepositional phrase function as an adjective?
    13·2 answers
  • How do you delete answers on this?
    10·2 answers
  • Latisha took a sealed, plastic container of ice cubes out of the freezer. the outside of the container was dry when she took it
    8·1 answer
  • Is suspences a tone or a mood?
    14·2 answers
  • What news did the shopkeeper turned policeman bring to Ellie and his family? Is it good or bad news
    10·1 answer
  • What should I pick? I give Brainlist for the best answers ;P
    8·1 answer
  • Fossils of the same plants and animal species have been found on continents that are separated by the Atlantic Ocean. Which of t
    14·1 answer
  • What is the poem mainly about?
    13·1 answer
  • Why is Mount Rushmore a big part of U.S. history
    6·1 answer
  • Do you think that prom is a positive high school tradition or a negative one?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!