Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Question

6. Use short-range goals to assist in achieving long-range goals.

Answered: 1 week ago