4 String matching with gaps In string matching with gaps the pattern P can contain a...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
4 String matching with gaps In string matching with gaps the pattern P can contain a gap character * that can match any string (of arbitrary length even length zero). An example of such a string is P= ab* ac * a, which occurs in the text T = bababacbcca in two ways: T: b ab ab ас bcc a P: ab * a ас or T: bab ab ac bcc a P: ab ас * a There are no gap characters in the text-only in the pattern. Solve the following exercises. 4.1 Show how to build a finite automaton that can find an occurrence of a gapped pattern in P in a text T in O(n) matching time. 4.2 Give an algorithm to find an occurrence of a pattern P containing gap characters in a text T in time O(n+m). That is, preprocessing time + matching time should be O(n+m)). 4 String matching with gaps In string matching with gaps the pattern P can contain a gap character * that can match any string (of arbitrary length even length zero). An example of such a string is P= ab* ac * a, which occurs in the text T = bababacbcca in two ways: T: b ab ab ас bcc a P: ab * a ас or T: bab ab ac bcc a P: ab ас * a There are no gap characters in the text-only in the pattern. Solve the following exercises. 4.1 Show how to build a finite automaton that can find an occurrence of a gapped pattern in P in a text T in O(n) matching time. 4.2 Give an algorithm to find an occurrence of a pattern P containing gap characters in a text T in time O(n+m). That is, preprocessing time + matching time should be O(n+m)).
Expert Answer:
Answer rating: 100% (QA)
set string input S a b c m7 for each automation Si S construct factor auto... View the full answer
Related Book For
Posted Date:
Students also viewed these algorithms questions
-
Show how to build a J-K flip-flop using a T flip-flop with enable and combinational logic.
-
Show (BA) T = AB for A and B in Example 2, for any n X n Hermitian A and skew-Hermitian B.
-
Show that there is no finite-state automaton with two states that recognizes the set of all bit strings that have one or more 1 bits and end with a 0.
-
On January 1, 2010, Phelps Company purchased an 85% interest in Sloane Company for $955,000 when the retained earnings of Sloane Company were $150,000. The difference between implied and book value...
-
A check valve (swing) and a globe valve are installed in series in an 8-in. pipe. Determine the flow rate if the pressure drop across the valves is 5.19 psi (lbs/in.2). Assume that the friction...
-
In Problems 7-20, find the area bounded by the graphs of the indicated equations over the given interval. Compute answers to three decimal places. 1 = y = 0; -1sxs-
-
Consider a stock price \(S\) governed by the geometric Brownian motion process (a) Using \(\Delta t=1 / 12\) and \(S(0)=1\), simulate several (i.e., many) years of this process using either method,...
-
What makes for a good investment? Use the approximate yield formula or a financial calculator to rank the following investments according to their expected returns. a. Buy a stock for $30 a share,...
-
Lucido Products markets two computer games: Claimjumper and Makeover. A contribution format income statement for a recent month for the two games appears below: Sales Variable expenses Claimjumper $...
-
Required: Analyze the transactions and identify it as: (1) Inward Clearing Checks (2) Over the Counter Checks (3) Fund Transfer (4) Withdrawals 5) DM and (6) CM. Provide a brief explanation of each...
-
Describe a topic, idea, or concept you find so engaging that it makes you lose all track of time. Why does it captivate you? What or who do you turn to when you want to learn more?
-
what connection does enculturation and intercultural communication have between each other? explain
-
What is the role of advocacy in shifting people's perceptions or attitudes of inclusion? explain
-
A survey of 41 randomly selected iPhone owners showed that the purchase price has a mean of $414 with a sample standard deviation of $180. a. Compute the standard error of the sample mean. Standard...
-
What is the difference between a subculture and a counterculture? Give an example of each
-
how did King Leopold gain ownership of his "Congo Free State," what was the nature of his rule over the population, and how did it become a target of humanitarian criticism?
-
A non-dividend - paying stock with a current price of $52, the strike price is $50, the risk free interest rate is 12% pa, the volatility is 30% pa, and the time to maturity is 3 months? a) Calculate...
-
You are maintaining a subsidiary ledger account for Police-Training Expenditures for 2013. The following columns are used: Inventory purchases are initially recorded as expenditures. Record the...
-
Total consumer and producer surplus is maximized under perfect competition. If government restricted the quantity that could be brought to market, how would this restriction affect price, quantity,...
-
In what ways is the New York Stock Exchange similar to a perfectly competitive market?
-
Distinguish among M1 and M2. In your opinion which is the best measure of the money supply? Why?
-
a. For the allowed energies of a particle in a box to be large, should the box be very big or very small? Explain. b. Which is likely to have larger values for the allowed energies: an atom in a...
-
The molecules in the rods and cones in the eye are tuned to absorb photons of particular energies. The retinal molecule, like many molecules, is a long chain. Electrons can freely move along one...
-
What was the approximate activity of the plutonium source at the start of the mission? A. \(2 \times 10^{21} \mathrm{~Bq}\) B. \(2 \times 10^{19} \mathrm{~Bq}\) C. \(2 \times 10^{17} \mathrm{~Bq}\)...
Study smarter with the SolutionInn App