COMS 482: unofficial class blog


Lecture 10: More Dynamic Programming

Posted in Class Notes by Elliott Back on February 14th, 2005. [Del.icio.us]

Divide and Conquer v. Dynamic Programming:

Both break problem into subproblems, then combine the results to get a solution. Divide and Conquer uses recursion to solve subproblems, while Dynamic Programming stores the subproblems in a table, and hopes it will keep encountering them.

Word Similarity Problem:

GIANT
GREEN
OGRE

Which words are most similar? Assign transformation costs:

  1. identical letters -> distance 0
  2. both vowels -> distance 1
  3. both consonants -> distance 1
  4. insert/delete -> distance 2
  5. vowels <-> consonants -> distance 3

For example, GREEN -> OGRE:

GREEN, GREE (2), GRE (2), OGRE (2) = 6
GREEN, GIEEN (3), GIAEN (1), GIAN (2), GIANT (2) = 8

This distance sum is called the edit distance.

Protein Sequence Alignment:

There are 20 amino acids, divided into several groups (nonpolar/polar). You want to look for similar sequence to try and guess at protein structure–same as word-matching problem, except that proteins contain 150-400 amino acids (words).

Conversion to Graph Problem:

Word matching as a graph problem

  • Now we can use Djikstra’s algorithm
  • Word size n, |v| = n2, |E| = O(n2)
  • O(n2 log n)

O(n2) Time Algorithm:

We want to find the optimum path from 0,0 to n,n, which is the diffence between words. First, create the graph table D whose entries are the cost of diagonal graph traversals, since the other kinds are simply of fixed cost 2. Then, run this algorithm:

For k =1 to n
    opt[0, k] = opt[k, 0] = 2 * k;
EndFor

For i = 1 to n
    For j = 1 to m
        opt[i, j] = min {(opt[i-1, j-1] + D[i, j]), (opt[i, j-1] + 2), (opt[i-1, j] + 2)}
    EndFor
EndFor

return opt[n,n]

This entry was posted on Monday, February 14th, 2005 at 2:02 pm and is tagged with , , , , , , , , , , , , , , , , , , , . You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback.

Leave a Reply

I'll protect you: the profound and precious Wordpress Hashcash?

Please take time to enjoy the archives: May 2005 (1) April 2005 (11) March 2005 (11) February 2005 (15) January 2005 (7)

Fresh, related resources:

Supplied by Google Blog Search
  • Upgrade! International: Call for Participation [Skopje]
    Urban Programming 101 - Taeyoon Choi [Seoul] is a public workshop where participants are expected to actively participate in order to understand, interpret and program the urban space: September 11-13, 10:00 ? 17:00hrs, ...
  • [VistaSoftware] Digest Number 1125
    You learn the fundamentals of HTML syntax, layout and CSS style sheets, creating effective Web pages, configuring a web server and designing databases using MySQL, producing dynamic web pages, retrieve and manipulate data, ...
  • Friday August 1, 2008
    Thahn-Son Dao, ?A Decentralized Approach to Dynamic Collaborative Driving.? Supervisors, Jan Huissoon and Chris Clark. On display in the faculty of engineering, PHY 3004. Oral defence Monday, August 18, 9:30 am, Engineering III room ...
  • 1 year fellowship for a doctoral researcher on program analysis
    Theory and practice of logic programming (Accepted) 2008. [12] W. Vanhoof. Searching semantically equivalent code fragments in logic programs. In S. Etalle, editor, LOPSTR 2004, volume 3573 of Lecture notes in computer science, pages ...
  • The Programming Task Considered as an Intellectual Challenge
    They have taught us much more: they have taught us that programming any non-trivial performance is really very difficult and I expect a much more profound influence from the the advent of the automatic computer in its capacity of a ...