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]
2 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]2 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
What The definition of Maintenance The same Thing as janitor and custodian
Flauer [41]

Answer:

Porter

Explanation:

a person employed to carry luggage and other loads, especially in a railway station, airport, hotel, or market.

4 0
3 years ago
Read the sentence, and then answer the question.
nika2105 [10]
D. To make the characters more real and believable.
4 0
3 years ago
Read 2 more answers
Write an essay stating your position on whether competition is necessary for success.
klemol [59]

Answer:

I can help you get started the rest is on you.

Competition is necessary for success. It prepares you for the real world.  

Competition makes you a better person because you have to work hard to win that competition. In a business you are going to work hard to make your business successful.

4 0
3 years ago
Failure is something that nobody wants to experience. Being unsuccessful often leaves people feeling a bit low. How do you overc
RoseWind [281]

Answer:Don’t give up.

Embrace obstacales as an open door for better things.

Be prepared.

Ask for help.

Explanation:

6 0
1 year ago
Which transitional words can be used to show location?
bearhunter [10]

Answer:

A

Explanation:

4 0
3 years ago
Other questions:
  • Which of the following contains a reference to the auditory or hearing sense?
    13·2 answers
  • What should the body of a research paper draft contain?
    7·2 answers
  • What are 5 way people can express themselves?
    8·1 answer
  • What is revealed propaganda
    10·2 answers
  • Why does Justyce walk all the way to find Melo?
    14·1 answer
  • Nonfiction reading test black friday
    6·1 answer
  • I waited maybe an hour and he didn't return ​
    8·1 answer
  • Fill in blanks : ram lived under a ......​
    15·1 answer
  • Why is it important to be prepared in order you won't struggle in life?
    8·1 answer
  • Which suspense technique is being used in the quote?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!