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
Sindrei [870]
3 years ago
10

Write a recursive method named editDistance that accepts string parameters s1 and s2 and returns the "edit distance" between the

two strings as an integer. Edit distance (also called Levenshtein distance) is defined as the minimum number of "changes" required to get from s1 to s2 or vice versa. A "change" can be defined as a) inserting a character, b) deleting a character, or c) changing a character to a different character. Call Value Returned editDistance("driving", "diving") 1 editDistance("debate", "irate") 3 editDistance("football", "cookies") 6
Computers and Technology
1 answer:
stepan [7]3 years ago
3 0

Answer:

Explanation:

The following code takes in the two parameters s1 and s2 and returns the Levenshtein distance of the two strings passed.

def editDistance(s1, s2):

   m = len(s1) + 1

   n = len(s2) + 1

   arr = {}

   for x in range(m):

       arr[x, 0] = x

   for y in range(n):

       arr[0, y] = y

   for x in range(1, m):

       for y in range(1, n):

           proc = 0 if s1[x - 1] == s2[y - 1] else 1

           arr[x, y] = min(arr[x, y - 1] + 1, arr[x - 1, y] + 1, arr[x - 1, y - 1] + proc)

   return arr[x, y]

You might be interested in
L’Oreal, a manufacturer of personal care and beauty products, has a focus on sustainability. It has developed eco-packaging, eli
Scorpion4ik [409]

Answer:

The Environment

Explanation:

Our environment is gravely under attack from the release of harmful substances by manufacturing companies in products or waste extracts.

L'Oreal is addressing the issue of the environment, by reducing the release of greenhouse gas and waste that has harmful effects on the environment.

Corporate Social Responsibility (CSR) is aimed at increasing the accountability of corporate organizations when handling socially-related activities.

Some CSR issues include Working conditions, Human rights, Corruption, Taxes, Gender Equality, Consumer rights and interest among others.

7 0
3 years ago
Which term describes the order of arrangement of files and folders on a computer?
jonny [76]
The term that best describes this would be called computer files and or organization file
6 0
3 years ago
Read 2 more answers
Which of the following will increase the level of security for personal and confidential information on a mobile device if the d
Soloha48 [4]
I believe is a and c.
8 0
4 years ago
I need help thanks please!
maw [93]

Answer:

a) to persuade

she is doing this to propose an idea to the boss of the company

6 0
3 years ago
Read 2 more answers
Employee names are stored using a maximum of 50 characters. This information is an example of which of the following?
enyata [817]

Answer: Data model

Explanation: Data model is the arrangement of the information in the form of table structure to maintain it in the form of database.They help in the keeping the entities in the sequence and can be tracked when required.Example- vendors records,customer record etc.

Other options are incorrect because the data retrieval is the regaining of the data from database, record instance is the parts of the database records  and meta data give knowledge about other data.

8 0
4 years ago
Other questions:
  • ATM machines respond to request in__________​
    13·1 answer
  • A(n) _______ is text or a graphic you can click to jump to another file or to somewhere else in the same file. quizle
    12·1 answer
  • True and False: High-speed Internet service is free form of information technology that these businesses can utilize.
    13·1 answer
  • What is some advice you would give someone who is just starting online learning 2 sentences
    8·1 answer
  • The following equations estimate the calories burned when exercising (source): Men: Calories = ( (Age x 0.2017) — (Weight x 0.09
    11·1 answer
  • Which of the following sections of a business plan comes first but should be written last?
    11·2 answers
  • তথ্য ও যোগাযোগ প্রযুক্তির প্রশ্ন(45)10 সংখ্যাটির সমতুল্য মান?
    14·1 answer
  • What intangible benefits might an organization obtain from the development of an
    5·2 answers
  • What is the output of the following C++ code? int list[5] = {0, 5, 10, 15, 20}; int j; for (j = 0; j < 5; j++) cout <<
    11·1 answer
  • Questions: What memory modules are needed if the customer wants 3 GB of RAM? What capacities and how many modules of each capaci
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!