Question: Question 2 ( 2 9 marks ) This question can be answered after studying Chapter 2 3 ( Dynamic Programming ) . It assesses the

Question 2(29 marks)
This question can be answered after studying Chapter 23(Dynamic Programming). It assesses the learning outcomes:
Develop and apply algorithms and data structures to solve computational problems.
Analyse the complexity of algorithms to support software design choices.
Explain how an algorithm or data structure works, in order to communicate with relevant stakeholders.
Write readable, tested, documented and efficient Python code.
In this question we aim to solve the same problem as in Question 1 given any two DNA sequences (strings containing only C, G, A or T) find their longest common substring but using a different approach.
You should provide a dynamic programming solution, following the examples in Chapter 23, adapting code as appropriate. You will lose marks if you do not follow an approach similar to Chapter 23.
Q2(a)(4 marks)
Write and test a recursive Python function lc_leading_substring, that returns the longest common leading substring of two strings, left and right. This means comparing the two strings starting from their first character. The function should return the empty string if there is no match. This function should be useful when you move on to coding part (b).
For example, the longest common leading substring of 'ACAGTC' and 'ACATGT' is 'ACA'. The longest common leading substring of 'ACAG' and 'CACAG' is the empty string ''.
Complete the function in the following cell. We have provided some tests - your tutor may use additional tests

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!