CS 530 Advanced Algorithm Design and Analysis s1

CS 530 Advanced Algorithm Design and Analysis s1

<p> CS 331-01 Design and Analysis of Algorithms Homework #4</p><p>1. Given A=[20x2], B=[2x15], C=[15x40], and D=[40x4]. Compute the C(i, j)'s defined in the class for all i < j and trace your computation to get the multiplication order for this instance of chained matrix multiplication.</p><p>2. Let A be the adjacency matrix of a directed graph G=(V, E), where A(i, j)=1 if <i, j>E and A(i, j)=0 otherwise. Define the transitive closure, A+, of A to be a matrix with the property A+(i, j)=1 iff G has a directed path, containing at least one edge, from vertex i to vertex j. A+(i, j)=0 otherwise. The reflexive transitive closure, A*, is a matrix with the property A*(i, j)=1 iff G has a path, containing zero or more edges, from i to j. A*(i, j)=0 otherwise. 1 2</p><p>4 3</p><p>(a) Obtain A, A+ and A* for the above directed graph. (b) Let Ak(i, j)=1 iff there is a path with zero or more edges from i to j going through no vertex of index greater than k. Define A0. (c) Obtain a recurrence definition between Ak and Ak-1 using the logical operators or and and rather than min and +. (d) Write an algorithm, using the recurrence of (c), to find A*. What is the time complexity of your algorithm?</p><p>3. Two character strings may have many common sub-strings. For example, photograph and tomography have several common sub-strings of length one (i.e., single letters), and common sub-strings ph, to, and ograph (as well as all the sub-strings of ograph). The maximum common sub-string length is 6. Let X = x1x2...xn and Y = y1y2...ym be two character strings. The Maximum Common Sub-string (MCS) Problem is to find the maximum common sub-string length for X and Y. </p><p>Let s[i, j] = the length of the longest common sub-string ending at xi and yj, define the functional equation for s[i, j] = s[i-1, j-1]+1 if xi = yj 0 otherwise Give an algorithm to implement this functional equation. What is the time complexity of your algorithm? </p><p>4. Given the cost adjacent matrix for a directed graph as below, find a tour of minimum cost starting from vertex 1 using the functional equation given in class. Show steps. 1 2 3 4 5 1 0 8 13 18 20 2 3 0 7 8 10 3 4 11 0 10 7 4 6 6 7 0 11 5 10 6 2 1 0</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    1 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us