/*! This file is auto-generated */ .wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;text-decoration:none;padding:calc(.667em + 2px) calc(1.333em + 2px);font-size:1.125em}.wp-block-file__button{background:#32373c;color:#fff;text-decoration:none} Q26E Sequence alignment. When a new g... [FREE SOLUTION] | 91影视

91影视

Sequence alignment. When a new gene is discovered, a standard approach to understanding its function is to look through a database of known genes and find close matches. The closeness of two genes is measured by the extent to which they are aligned. To formalize this, think of a gene as being a long string over an alphabet ={A,C,G,T}. Consider two genes (strings) x=ATGCCand y=TACGCA. An alignment of x and y is a way of matching up these two strings by writing them in columns, for instance:

A-T-GCCTA-CGC

Here the 鈥淿鈥 indicates a 鈥済ap.鈥 The characters of each string must appear in order, and each column must contain a character from at least one of the strings. The score of an alignment is specified by a scoring matrixof size (+1)(+1), where the extra row and column are to accommodate gaps. For instance the preceding alignment has the following score:

(-T)+(A,A)+(T,-)+(G,G)+(C,C)+(C,A)

Give a dynamic programming algorithm that takes as input two strings X[1K n] and Y {1K m} and a scoring matrix and returns the highest-scoring alignment. The running time should be O(mn) .

Short Answer

Expert verified

The dynamic algorithm that runs in O(nm) time has been obtained.

Step by step solution

01

Explain the given problem

Consider the two strings x and y with the length n and m respectively. Define a 2-Dimension array or a matrix that stores the score of aligning the string. Each value of the matrix signifies the score of aligning the sequence .

02

Defining the Recursive Relation

Based on he given condition, The matrix should be constructed using the following condition:

  • Align the strings as it is in input but omit the last element of these strings and then align characters xpand yp
  • The recurrence will be:Si,j=maxSi-1,j+xi,-Si,j-1,j+-,yiSi-1,j-1+0xi,yj
03

Analysis of the Recurrence Relation

Since string x1x2x3Kxphas n characters and string y1y2y3kyqhas characters, The recursion relation will run up to n*mtimes. Hence time complexity is: O (nm).

Therefore, the dynamic algorithm that runs in O (nm) time has been obtained.

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with 91影视!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

Given an unlimited supply of coins of denominations, we wish to make change for a value ; that is, we wish to find a set of coins whose total value is . This might not be possible: for instance, if the denominations are and 10 then we can make change for 15 but not for 12. Give an dynamic-programming algorithm for the following problem.Input:,; .Question: Is it possible to make change for using coins of denominations ?

Let us define a multiplication operation on three symbols a,b,caccording to the following table; thus ab=b,ba=c, and so on. Notice that the multiplication operation defined by the table is neither associative nor commutative.

Find an efficient algorithm that examines a string of these symbols, say bbbbac, and decides whether or not it is possible to parenthesize the string in such a way that the value of the resulting expression is . For example, on input bbbbacyour algorithm should return yes because((b(bb))(ba))c=a.

Yuckdonald鈥檚 is considering opening a series of restaurant along Quaint Valley Highway(QVH). The n possible locations are along a straight line, and the distances of these locations from the start of QVH are, in miles and in increasing order,m1,m22,....,mn.. The constraints are as follows:

At each location, Yuckdonald may open at most one restaurant. The expected profit from opening a restaurant at location i is given aspi, wherepi>0andi=1,2,,n.

Any two restaurants should be at least k miles apart, where k is a positive integer.

Give an efficient algorithm to compute the maximum expected total profit subject to the given constraints.

The garage sale problem (courtesy of Professor Lofti Zadeh). On a given Sunday morning, there are n garage sales going on, g1,g2,g3............gn. For each garage sale gj, you have an estimate of its value to you, vj. For any two garage sales you have an estimate of the transportation cost dijof getting from gito gj. You are also given the costs d0jand dj0of going between your home and each garage sale. You want to find a tour of a subset of the given garage sales, starting and ending at home, that maximizes your total benefit minus your total transportation costs. Give an algorithm that solves this problem in time O(n22n).

(Hint: This is closely related to the traveling salesman problem.)

A mission-critical production system has n stages that have to be performed sequentially; stage i is performed by machine Mi. Each machine Mi has a probability riof functioning reliably and a probability 1-riof failing (and the failures are independent). Therefore, if we implement each stage with a single machine, the probability that the whole system works is r1r2rn. To improve this probability we add redundancy, by having mi copies of the machine Mi that performs stage i. The probability that all mi copies fail simultaneously is only (1-ri)mi,so the probability that stage i is completed correctly is 1 鈭 (1-ri)mi, and the probability that the whole system works isni=1(1-1-rimi).Each machine has a cost ci, and there is a total budget to buy machines. (Assume that B and ciare positive integers.) Given the probabilities r1r2rn, the costsc1,...,cn, and the budget find the redundanciesm1,...,mn that are within the available budget and that maximize the probability that the system works correctly.

See all solutions

Recommended explanations on Computer Science Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.