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
Alex_Xolod [135]
3 years ago
12

You are given a string of n characters s[1 : : : n], which you believe to be a corrupted text document in which all punctuation

has vanished (so that it looks something like itwasthebestoftimes...). You wish to reconstruct the document using a dictionary, which is available in the form of a Boolean function dict(): for any string w, dict(w) = true if w is a valid word false otherwise . (a) Give a dynamic programming algorithm that determines whether the string s[] can be reconstituted as a sequence of valid words. The running time should be at most O(n2), assuming calls to dict take unit time. (b) In the event that the string is valid, make your algorithm output the corresponding sequence of words.
Computers and Technology
1 answer:
alexdok [17]3 years ago
8 0

Answer: provided in the explanation section

Explanation:

Given that:

Assume D(k) =║ true it is [1 : : : k] is valid sequence  words or false otherwise

  • To determine D(n)

now the sub problem s[1 : : : k] is a valid sequence of words IFF s[1 : : : 1] is a valid sequence of words and s[ 1 + 1 : : : k] is valid word.

So, from here we have that D(k) is given by the following recorance relation:

D(k) = ║ false maximum (d[l]∧DICT(s[1 + 1 : : : k]) otherwise

Algorithm:

Valid sentence (s,k)

D [1 : : : k]             ∦ array of boolean variable.

for a ← 1 to m

do ;

d(0) ← false

for b ← 0 to a - j

for b ← 0 to a - j

do;

if D[b] ∧ DICT s([b + 1 : : : a])

d (a) ← True

(b). Algorithm Output

      if D[k] = = True

stack = temp stack           ∦stack is used to print the strings in order

c = k

while C > 0

stack push (s [w(c)] : : : C] // w(p) is the position in s[1 : : : k] of the valid world at // position c

P = W (p) - 1

output stack

= 0 =

cheers i hope this helps !!!

You might be interested in
What legal punishment can people face for plagerism
Maru [420]
They can get a fine.
5 0
3 years ago
The security administrator for Corp wants to provide wireless access for employees as well as guests. Multiple wireless access p
Artemon [7]
It’s B I took the test
7 0
3 years ago
Robert's computer is not starting due to an error in the BIOS. Which of these chips could have malfunctioned? Select the correct
timofeeve [1]

Hi;

In the question, Robert gives the explanation that there is an error in the BIOS. A BIOS (Standing for Basic Input & Output System) is a ROM chip, and is vital for the computer to initialize devices such as RAM, the CPU, etc. If there is ever an error there, a computer simply cannot boot.

From the options given, your answer given would be C. ROM.

I hope this helps!

8 0
3 years ago
Project: Semiconductor Chips
ohaa [14]

Answer:

Image result for construction of semiconductor

A semiconductor device is an electronic component that relies on the

Explanation:

8 0
3 years ago
What are two ways technology has helped improve in the way we deal with waste?
topjm [15]
It allow us to monitor and study our environment to better understand how it works and the impact of our actions on it and It allows for paperless communication like email and online bill paying to reduce the amount of trees cut down
3 0
3 years ago
Read 2 more answers
Other questions:
  • Jeffrey works with a huge database of spreadsheet records each day. To organize and identify these spreadsheets, he wants to ass
    8·1 answer
  • Are headphones considered a computer? Why or why not?
    13·2 answers
  • The shortest compressed format of the ipv6 address 2001:0db8:0000:1470:0000:0000:0000:0200 is
    6·1 answer
  • Gregory Yob is associated with which of these games?
    7·2 answers
  • People are starting to type in whole questions rather than specific words, which leads credence to having _____ that have this a
    14·1 answer
  • _____ involves storing data and running applications outside the company’s firewall. answer grid computing parallel computing cl
    11·1 answer
  • What direction would a sprite go if you constantly increased its x property? Your answer What direction would a sprite go if you
    7·1 answer
  • The IPv4 address scheme has enough IP addresses to give every blade of glass in the world its own unique IP. True False
    8·1 answer
  • Time shifting occurs when
    8·2 answers
  • What is the sequence of instructions performed to execute one program instruction
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!