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
hram777 [196]
3 years ago
15

Write a recursive method called lengthOfLongestSubsequence(a, b) that calculates the length of the longest common subsequence (l

cs) of two strings. For example, given the two strings aaacommonbbb and xxxcommonzzz the lcs is common which is 6 characters long so your function would return 6. The length of the lcs of two strings a
Computers and Technology
1 answer:
kompoz [17]3 years ago
4 0

Answer:

Explanation:

The following code is written in Java and creates the recursive function to find the longest common substring as requested.

 static int lengthOfLongestSubsequence(String X, String Y) {

       int m = X.length();

       int n = Y.length();

       if (m == 0 || n == 0) {

           return 0;

       }

       if (X.charAt(m - 1) == Y.charAt(n - 1)) {

           return 1 + lengthOfLongestSubsequence(X, Y);

       } else {

           return Math.max(lengthOfLongestSubsequence(X, Y),

                   lengthOfLongestSubsequence(X, Y));

       }

   }

You might be interested in
You are creating a story map about Mexico. After configuring the web app template, you launch the app to test it. When the app o
navik [9.2K]
Nbdjsksjsidjdjwkwejd
3 0
3 years ago
What type of software translates a programmer’s statements to binary form?
Aleks04 [339]
A compiler, which has several parts, translates source code to executable code.
3 0
3 years ago
Mark for review (Will be highlighted on the review page) 11. A feature in Excel that allows you to graphically display in a sing
Tresset [83]
A feature in Excel that allows you to graphically display in a single cell the trend across a range of cells is called a sparkline.
8 0
3 years ago
How do we add questions on sam Blockly?​
Blizzard [7]

Answer:

I do not know that answer

5 0
3 years ago
Write a program that will open a file named thisFile.txt and write every other line into the file thatFile.txt. Assume the input
Naily [24]

Answer:

Check the explanation

Explanation:

The programmable code to solve the question above will be written in a python programming language <u><em>(which is a high-level, interpreted, general-purpose programming language.)</em></u>

<u><em /></u>

f = open('thisFile.txt', 'r')

w = open('thatFile.txt', 'w')

count = 0

for line in f:

   if count % 2 == 0:

       w.write(line)

   count += 1

w.close()

f.close()

4 0
2 years ago
Other questions:
  • People are able to predict future events to some extent because: (Select all that apply)
    11·1 answer
  • In windows, a(n) ________ follows the file name and a period and indicates the file type.
    9·1 answer
  • When seeking information on the Internet about a variety of subjects, the most
    7·2 answers
  • Your school has been declared a school of technology
    15·1 answer
  • Answer the queston...........​
    7·2 answers
  • What is polymerization1​
    11·1 answer
  • Why should running your unit test suites not take a long time?A. Unit tests aren't that important, so less time should be spent
    5·1 answer
  • Write a Python function that join the two string and print it ​
    14·2 answers
  • When looking at aggregated logs, you are seeing a large percentage of Windows hosts connecting to an Internet Protocol (IP) addr
    5·1 answer
  • Imagine that your parents were starting a small business, and they wanted to upgrade their data storage. Would you recommend a f
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!