A substring of some character string is a contiguous sequence of characters in that string (which is different than a subsequence, of course). Suppose you are given two character strings, X and Y , with respective lengths n and m. Describe an efficient algorithm for finding a longest common substring of X and Y .For each algorithm:i. Explain the main idea and approach.Write appropriate pseudo-code.Trace it on at least three different examples, including at least a canonical case and two corner cases.
iv. Give a proof of correctness.v. Give a worst-case asymptotic running time analysis.

Answers

Answer 1

Answer:

create a 2-dimensional array, let both rows represent the strings X and Y.

check for the common characters within a string and compare them with the other string value.

If there is a match, append it to the array rows.

After iterating over both strings for the substring, get the longest common substring for both strings and print.

Explanation:

The algorithm should create an array that holds the substrings, then use the max function to get the largest or longest substring in the array.


Related Questions

Which of the following is NOT true?

a. The process provides the macro steps
b. Methodologies provide micro steps that never transcends the macro steps.
c. Methodologies provide micro steps that sometimes may transcend the macro steps.
d. A methodology is a prescribed set of steps to accomplish a task.

Answers

Answer:

b. Methodologies provide micro-steps that never transcends the macro steps.

Explanation:

Methodologies are a series of methods, processes, or steps in completing or executing a project. Projects can be divided into macro steps or processes and these macro steps can be divided into several micro-steps. This means that, in methodology, micro-steps always transcends to a macro-step.

Write a SELECT statement that returns these columns from the Customers table:
Customer last name customer_last name column
City customer_city column
Zip code customer_zip Column
Return only the rows with customer_state equal to IL .
Sort the results in Descending order of customer last name
SCHEMA:
CREATE TABLE customers
(
customer_id INT NOT NULL,
customer_last_name VARCHAR(30),
customer_first_name VARCHAR(30),
customer_address VARCHAR(60),
customer_city VARCHAR(15),
customer_state VARCHAR(15),
customer_zip VARCHAR(10),
customer_phone VARCHAR(24)
);
INSERT INTO customers VALUES
(1, 'Anders', 'Maria', '345 Winchell Pl', 'Anderson', 'IN', '46014', '(765) 555-7878'),
(2, 'Trujillo', 'Ana', '1298 E Smathers St', 'Benton', 'AR', '72018', '(501) 555-7733'),
(3, 'Moreno', 'Antonio', '6925 N Parkland Ave', 'Puyallup', 'WA', '98373', '(253) 555-8332'),
(4, 'Hardy', 'Thomas', '83 d''Urberville Ln', 'Casterbridge', 'GA', '31209', '(478) 555-1139'),
(5, 'Berglund', 'Christina', '22717 E 73rd Ave', 'Dubuque', 'IA', '52004', '(319) 555-1139'),
(6, 'Moos', 'Hanna', '1778 N Bovine Ave', 'Peoria', 'IL', '61638', '(309) 555-8755'),
(7, 'Citeaux', 'Fred', '1234 Main St', 'Normal', 'IL', '61761', '(309) 555-1914'),
(8, 'Summer', 'Martin', '1877 Ete Ct', 'Frogtown', 'LA', '70563', '(337) 555-9441'),
(9, 'Lebihan', 'Laurence', '717 E Michigan Ave', 'Chicago', 'IL', '60611', '(312) 555-9441'),
(10, 'Lincoln', 'Elizabeth', '4562 Rt 78 E', 'Vancouver', 'WA', '98684', '(360) 555-2680');

Answers

Answer:

SELECT customer_last_name, customer_city, customer_zip FROM customers WHERE customer_state = 'IL' ORDER BY customer_last_name DESC;

Explanation:

Here, we are given a SCHEMA with the table name customers.

It's creation command and commands to insert values are also given.

We have to print the customer last name, city and zip code of all the customers who have their state as IL in the decreasing order of their last names.

Let us learn a few concepts first.

1. To print only a specified number of columns:

We can write the column names to be printed after the SELECT command.

2. To print results as per a condition:

We can use WHERE clause for this purpose.

3. To print in descending order:

We can use ORDER BY clause with the option DESC to fulfill the purpose.

Therefore, the answer to our problem is:

SELECT customer_last_name, customer_city, customer_zip FROM customers WHERE customer_state = 'IL' ORDER BY customer_last_name DESC;

Output of the command is also attached as screenshot in the answer area.

Which formatting option(s) can be set for conditional formatting rules?

Answers

Answer:

D

Explanation:

Any of these formatting options as well as number, border, shading, and font formatting can be set.

what types of problems if no antivirus is not installed

Answers

If you meant what would happen if you don't install an antivirus software, trust me, you don't want to know. I'd definitely recommend either Webroot (I believe that's how it's spelled) or Mcafee.

Pointers are addresses and have a numerical value. You can print out the value of a pointer as cout << (unsigned)(p). Write a program to compare p, p + 1, q, and q + 1, where p is an int* and q is a double*. Explain the results.

Answers

Answer:

#include <iostream>

using namespace std;

int main() {

  int i = 2;

  double j = 3;

 

  int *p = &i;

  double *q = &j;

 

  cout << "p = " << p << ", p+1 = " << p+1 << endl;

  cout << "q = " << q << ", q+1 = " << q+1 << endl;

  return 0;

}

Explanation:

In C++, pointers are variables or data types that hold the location of another variable in memory. It is denoted by asterisks in between the data type and pointer name during declaration.

The C++ source code above defines two pointers, "p" which is an integer pointer and "q", a double. The reference of the variables i and j are assigned to p and q respectively and the out of the pointers are the location of the i and j values in memory.

Select the correct answer from each drop-down menu.
Complete the sentence listing the basic parts of a computer.
All computers have these four basic parts: an input device, a

Answers

Answer:

all computers have an input device, storage, proccesing,and output

hope it helped

Explanation:

Any one know??please let me know

Answers

Answer:

B

Explanation:

Answer:

The answer is B.

Explanation:

Also I see your using schoology, I use it too.

A video game character can face one of four directions

Answers

Really
I didn’t know that:)
Other Questions
1.Fill in the blank in the following sentence with the appropriate irregular, future tense form of the verb tener.Este ao, las clases van a ser mucho ms difciles. Nosotros ____ mucha tarea.2.Fill in the blank in the following sentence with the appropriate irregular conditional form of the verb poder.Paula y Carlos ____ ir al cine con nosotros, si no tuvieran ya otros planes Using your strengths, write a short speech convincing your principal have no school on Fridays- Hi It would mean everything if you could help me on this. Thanks! PLEASE HELP Based only on the information given in the diagram, which congruencetheorems or postulates could be given as reasons why AHIJE AKLM?Check all that apply. . B. ASAC. AASD. LLE. HLF. LA -7 Write a sentence telling what being a soldier in the war may have been like. Juanita constructed a number line to test her brothers understanding of opposites. She tested him on all points that were labeled with letters. Her brother had trouble representing the opposite of point A.Which represents the opposite of Point A?Negative (negative 10)Negative (negative 5)0Negative (10) You can tell the age of a skeleton by looking at:O1) the length of the femurO2) the shape of the pelvisO 3) the number of fused bonesO4) the color of the bones Tempo Company's fixed budget (based on sales of 16,000 units) for the first quarter reveals the following FixedBudgetSales (16,000 units X $211 per unit) 2184,000 Cost of goods sold Direct materials 322,000Direct labor 602,000Production supplies 392,000Plant manager salary 122,000 14,38,000Gross profit 13,76,000Selling expenses Sales commissions 112,000Packaging 210,000Advertising 100,000 422,000 Administrative expenses Administrative salaries 172,000Depreciation-office equip. 142,000Insurance 112,000Office rent 122,000 548,000Income from operations 406,000 (1) Compute the total variable cost per unit. (2) Compute the total fixed costs. (3) Compute the income from operations for sales volume of 14,000 units. (4) Compute the income from operations for sales volume of 18,000 units. Description is provided in image What are the ingredients in a candy cane? The money demand function for an economy is given by (M/P)d = (0.6Y)/(i1/2). If output is 1,000 units, the nominal interest rate is 9%, and the money supply is $1,200, the price level is _____. write A sentence comparing two different types protists Question 6 (10 points)The Washington Monument in our nation's capital is 555 ft high. Neglecting the effects of air resistance, what would be thespeed of the penny as it "hit" the ground?ObOcOd48.3 m/s-68.4 m/s84.7 m/s-57.6 m/s Which of the following statements is true about cellular respiration?A.Aerobic respiration produces substantially more ATP than anaerobic respiration.B.Anaerobic respiration produces substantially more ATP than aerobic respiration.C.Aerobic respiration occurs before glycolysis.D.Anaerobic respiration occurs before glycolysis Please help me with this. Do NOT steal the points because you need them, I will report you and brainly MIGHT take the points away. what major shift did art experience sue to the industrial revolution An online camping supplies outlet charges $14 for a canteen,and shipping is $2 per order.Part AWrite an expression that CJ can use to find the total cost indollars for ordering n canteens.Part BCJ orders 2 canteens and his friend Cameron orders 4 canteens.What is the total cost, including shipping, for both orders?Show your work. please help me this is due soon :(( giving brain liest for whoever does it right, and it does it in there own words, ITS OK IF A LITTLE IS FROM THE INTERNET :D pls help im giving brain liest :) Describe how England established territorial claims in North America. Include these terms in your answer: John Cabot, London Company, Jamestown.