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
What does it mean to calculate frequencies within a dataset
Vadim26 [7]
To count the number of times a dataset is used by a student 
<span>to calculate the product of two variables to make a third variable </span>
<span>to count the number of cases that fall into different subgroups within a dataset </span>
<span>to calculate the sum of a column of variables in a dataset </span>
7 0
3 years ago
Read 2 more answers
Organizations should communicate with system users throughout the development of the security program, letting them know that ch
Fed [463]

Answer:

Yes it is true.The organization should indeed communicate with a system user throughout the development of a security program. A corporation needs a security policy that must be developed by management at all levels, including organization and employees at the operational level. For a corporate security plan, it is essential to reduce the resistance of the expected changes and define the objective.

Explanation:

Three objectives of the security plan in an organization are:

  • Identify the sensitive system and plan
  • Create and define the strategy and control of the system.
  • Develop and implement the training programs.

Security Information is one of the essential factors in the organization.For an organization, the information should be protected.

7 0
3 years ago
Certain country in the Caribbean Sea recently held an election to choose its president. Every vote cast was electronic, but unfo
lesya [120]

Answer:

Certain country in the Caribbean Sea recently held an election to choose its president. Every vote cast was electronic, but unfortunately, a recent power surge caused a malfunction in the system just before votes were counted. The only information saved consists of the following facts:

Explanation:

• All the N citizens casted their vote.

• Exactly one candidate received more than N/2 votes.

• We don’t know how many candidates there were.

You are hired to help using your expertise in algorithms.

5 0
2 years ago
Explain how communication promotes cooperation and industrial peace​
tensa zangetsu [6.8K]

Explanation:

Communication helps the management to know what the organisation wants and how it can be performed. Through effective way of communication it promotes the industrial peace and good relations. 7. ... It enables the management to take managerial decisions which depends upon the quality of communication.

4 0
3 years ago
What language do the Vikings speak in the game " For Honor"?
aivan3 [116]
In the game the Vikings speak icelandic
3 0
3 years ago
Read 2 more answers
Other questions:
  • What bug was supposed to start affecting computers on january 1 2000
    9·1 answer
  • If a ≤m b and b is regular, does that imply that a is a regular language? why or why not?
    6·1 answer
  • A/an ________is a device used to protect computers against surges and spikes in power.
    14·1 answer
  • You work part time at a computer repair store. You are in the process of building a new computer system. The customer wants a mo
    6·1 answer
  • The primary reason for a company to outsource jobs is to
    8·2 answers
  • You and your project team have been asked to generate a solution to a problem. The problem is not complicated, and you are sure
    6·1 answer
  • Which of the following should be performed to prove the value of a security awareness training program?
    8·1 answer
  • How much memory will be occupied by black and white image​
    8·2 answers
  • What is a graphics card?
    5·1 answer
  • I just wanna know how many times a day y'all hit the tutor button at the bottom
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!