Problem 1. (10 points) Solve the longest common subsequence problem for the strings x = abbaab and y = babbaaa using the dynamic programming algorithm described in class. IE Fill in the table below (simply stating that the answer is 5 will get little or no credit). 01234567 0 1 2 3 4 5 6
Added by Emily H.
Close
Step 1
First, we create a table with the lengths of the two strings as the dimensions: 0|1|2|3|4|5|6|7 0| | | | | | | | 1| | | | | | | | 2| | | | | | | | 3| | | | | | | | 4| | | | | | | | 5| | | | | | | | Show more…
Show all steps
Your feedback will help us improve your experience
Sri K and 96 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Question 4. (5 points) Longest common subsequence problem Suppose that you have a very fast machine to execute the Smith-Waterman algorithm with any user-specific substitution cost matrix and linear gap penalty (such special-purpose machines exist and were fashionable in the 90's). How would you use it to solve the longest common subsequence: Given two DNA sequences S and T, find the longest sequence X that is a subsequence of both S and T. Note: Subsequences and substrings are two different things. A subsequence is made of characters that occur in the right order in the input spring, but not necessarily consecutively. A substring is a set of consecutive characters of the input string. So every substring is a subsequence, but not vice-versa. For example, BOICS is a subsequence of BIOINFORMATICS, but it is not a substring. IRO is neither a subsequence nor a substring of BIOINFORMATICS.
Sri K.
Find an increasing subsequence of maximal length and a decreasing subsequence of maximal length in the sequence 22, 5, 7, 2, 23, 10, 15, 21, 3, 17.
Counting
The Pigeonhole Principle
We want to select the shortest highway route between two cities. The network in the Figure provides the possible routes between the starting city at node 1 and the destination city at node 7. The routes pass through intermediate cities designated by nodes 2 to 6. Solve the problem with Dynamic Programing using backward recursion? (Provide the shortest distance in miles and the route).
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD