Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 3 (30 points). Longest Common SubString In this problem, you may use the in operator for strings: if u and v are strings, u

image text in transcribed

Problem 3 (30 points). Longest Common SubString In this problem, you may use the in operator for strings: if u and v are strings, u in v returns True if u is a substring of v, and returns False otherwise. Given two strings a and t, we are interested in substrings w common to both s and t, i.e., in terms of the in operator, w in s and w in t. We would like to find the maximum length of such 4. Implement a function lengthlCSS(8,t) which, given two strings a and t, returns the maximum length of a substring common to both s and t. Notes: The longest common substring may not be unique, but the maximum length of a common substring the value we are interested in computing is unique. Note that the comparison is case sensitive, e.g.. the characters 'B' and 'b' are not equal. Sample outputs given below, where a longest common substring is underlined. Test program/output: print(lengthlcss("Ballouta zghire", "Une ballouta kbire") ) 8 print(lengthlcss("abcdefghik", "zxyabczzfghik")) print(lengthlcss("Why", "Pourquoi")) print (lengthLCSS("", "empty")) print(lengthless ("Two maximal substrings" , "Twomax")) Any correct solution is worth 27 points. Faster solutions are worth more points. Efficient solutions are worth up to 10 additional bonus points. Submit your code in a file called Prob3.py including your name and ID number

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions