Write recursive function to and the lcs of two input string

Assignment Help Python Programming
Reference no: EM131747373

Assignment: Introduction to Computer Science for Life Scientists

Exercise 1 (Dynamic Programming)

Searching for the longest common subsequence (LCS) of biosequences is one of the most important tasks in Bioinformatics. A subsequence is a sequence that appears in the same relative order, but not necessarily contiguous. For example given a sequence S =\AGGTACCCGATC", all \AGT", \TAGAT", \GGG", and ... are subsequences of S.. In Bioinformatics the length of the longest commen subsequence between two biosequences is a good measure for the similarity of the two sequences.

a) Write a recursive function to and the LCS of two input string of size n and m. (3P)

b) For two sequences of size n, what is the running time complexity of your function in part a), where all possible subsequences are computed for both sequences? Brie y explain your answer. (2P)

c) This time use dynamic programming to nd the LCS of two input string of size n and m. (5P)

d) Write a python function that uses your idea in part c) to nd the LCS of two input strings S1 and S2. Test your function with the following sequences: (3P)

S1=\AGGTACCCGATC", S2=\GTAAGAGTACCGATTGATC"
S1=\AGATTCCCCACCTTAGA", S2=\AGGAATCCCCAACCTGA"

e) Briefly explain what is the running time complexity of LCS function in part d)? (2P)

Exercise 2 (Sorting)

a) Suggest an algorithm with O(n) average running time complexity to nd the ith smallest value in set S of size n. For example for S = f5; 3; 1; 7; 2; 3; 1g the third smallest element is 2. You are not allowed to use counting or radix sort. Hint: Think how you could make use of the idea of quick sort for searching. (5P)

b) Suggest an algorithm with O(nk) running time complexity to sort a list of n strings, where the strings may have di erent lengths with k being the length of the longest string. For example for [\b",\cda",\db",\da",\ab",\a"], the sorted list must be [\a",\ab",\b",\cda",\da",\db"]. (5P).

Reference no: EM131747373

Questions Cloud

Product must meet in order to be fair trade certified : What are some criteria a product must meet in order to be Fair Trade certified?
Construct a confidence interval estimate : Construct a Confidence Interval Estimate - collect a sample of books consisting of the ages of book (based on copyright dates). Plan and describe the sampling
What do you think will happen : What do you think will happen? Consider using the Simple Random Sample applet to select a sample of size 5 from a population of size 10.
What is the probability of a team bonus : Sports and Leisure The fielding percentage for a major league baseball team is a measure of how well defensive players handle a batted ball (without error).
Write recursive function to and the lcs of two input string : Assignment: Introduction to Computer Science for Life Scientists. Write a recursive function to and the LCS of two input string of size n and m.
Define the sample proportion of programs never watched : Psychology and Human Behavior Many Americans own a DVR or subscribe to a special TV recording service. For example, the Hopper from DISH network allows users.
Compute the amount of trash that washes onto the shore : Biology and Environmental Science Ships dumping garbage and ordinary beachgoers contribute to the increasing amount of trash that washes onto the shore.
Prepare the entry for columbia''s journal to record receipt : Prepare the entry for Columbia's journal to record receipt of cash in payment for the sale within the discount period
Determine three roles that interest groups play : Determine three roles that interest groups play in American politics in terms of impacting election outcomes.

Reviews

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd