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
To create a chart, you need to select at least
Nitella [24]

To create a chart, you need to select at least two cells in a range of data.

two cells

<u>Explanation:</u>

In MS excel end user can create graph through insert menu and select chart. In MS excel end user should have enough data in each cells to generate graphs.  

In MS EXCEL end user can create bar graph, pie chart, and line graph. Normally graph means comparing either two sets of values or range of values.

If we select one value it is just graph which gives performance data.

Purpose of graph is to do analysis in graphical presentable manner which an organization can under visual rather than comparing values.

6 0
3 years ago
Which of the following are pointers?
Pachacha [2.7K]

Answer:

Is there any options here

4 0
2 years ago
When Mark completed his research paper, he decided that he wanted to have all headings to be in bold, underlined, and 14 points.
MatroZZZ [7]

CTRL/CMD + B (BOLD)

CTRL/CMD + U (Underline)

CTRL/CMD + ] or [ (change font size)

6 0
2 years ago
__ is/are the amount of blank space between lines of text in a paragraph
Natali [406]
Indents? Double Space? one of those
5 0
3 years ago
Read 2 more answers
1. Discuss the pros and cons of human-computer interaction technology?
Lana71 [14]

!

gcoo!!Exykgvyukhhytocfplanationufvhyg:

3 0
3 years ago
Other questions:
  • Help asap. 10 points.
    8·2 answers
  • 1. _______ is when two things happen at one time when using the Scratch program.
    6·1 answer
  • Litmus-type test strips are used to test coolant for freeze protection and ?
    12·1 answer
  • What will be displayed as a result of executing the following code?
    5·1 answer
  • What is the name for the type of flash memory that is used by mobile devices to store their apps and data?
    6·1 answer
  • List the five parts of a system.describe them.
    13·1 answer
  • What will you see on the next line after the following lines of code?
    12·1 answer
  • Help it don’t let me click what do I do
    13·1 answer
  • How is the architecture converted into software code? Elaborate the steps its passes through with help of examples / Diagram.
    15·1 answer
  • The following is a function:
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!