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
Who is Theoclymenus?
jasenka [17]
B. He is a seer that Odysseus kills for consorting with the suitors.
6 0
3 years ago
Read 2 more answers
The main argument of “The Human Drift” can be found in this line: “The history of civilisation is a history of wandering, sword
ira [324]

London's supporting argument can be found in the following excerpt:

It has always been so, from the time of the first pre-human anthropoid crossing a mountain-divide in quest of better berry-bushes beyond, down to the latest Slovak, arriving on our shores to-day, to go to work in the coal-mines of Pennsylvania. These migratory movements of peoples have been called drifts, and the word is apposite. Unplanned, blind, automatic, spurred on by the pain of hunger, man has literally drifted his way around the planet. There have been drifts in the past, innumerable and forgotten, and so remote that no records have been left, or composed of such low-typed humans or pre-humans that they made no scratchings on stone or bone and left no monuments to show that they had been.

With these lines, London elaborates on his main argument. Whether it is the pre-human anthropoid or the Slovak who works in coal mines, the aim is the same: subsistence. It is not money but food that drives men to wander. These drifts are almost involuntary and fueled by hunger. 

Once he establishes that food is the prime reason that humans drift, London says that the second factor is fear: 

Dominated by fear, and by their very fear accelerating their development, these early ancestors of ours, suffering hunger-pangs very like the ones we experience to-day, drifted on, hunting and being hunted, eating and being eaten, wandering through thousand-year-long odysseys of screaming primordial savagery, until they left their skeletons in glacial gravels, some of them, and their bone-scratchings in cave-men’s lairs.

These lines support London’s argument that human beings are also driven by fear. This fear can also be seen in London’s main argument through the phrase “sword in hand.” When the primary need for food has been met, the next human need is protection and self-defense. London’s arguments about obtaining food and protection reflect the Darwinian theory of the survival of the fittest.

6 0
3 years ago
Read 2 more answers
A con artist is a person who wants to give you money. <br> True or false !!!
atroni [7]

Answer:

False

Explanation:

7 0
4 years ago
Read 2 more answers
Write an 8-10 sentence paragraph about your experience during the Enhanced Community Quarantine (ECQ) on a short bond paper. Use
goldenfox [79]

Explanation:

912 037 6469

p--love

come who r not comfortable in clothes

jo.in.this.o.n.

Z.00.M

4 0
3 years ago
If you are researching the effects of pollution on asthma patients, what should your notes include?
grigory [225]

Answer:

a list of effects

Explanation:

and possibly an explanation of each effect

8 0
3 years ago
Read 2 more answers
Other questions:
  • One of the characteristics of a tragic hero is "a good person who is brought down by an act of injustice". Explain why Creon's c
    14·1 answer
  • Treasure Island Questions - Please help!
    9·2 answers
  • Which sentence has no errors in the use of quotation marks or italics? A. Ernest Hemingway, an American novelist who lived in Pa
    9·1 answer
  • why do you think it is important for you to learn about whom you can go to for your own needs and the needs of your family?​
    7·1 answer
  • Read the introductory paragraph of an argument.
    12·1 answer
  • YALL HELPPPP
    13·2 answers
  • Which of the following best describes the gods treated one another in greek myths?
    14·1 answer
  • Which prediction about the plot does this
    5·2 answers
  • Which of the following sentences keeps a consistent verb tense?
    8·1 answer
  • This excerpt is an example of which value important to ancient Greek society?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!