120 likes | 470 Vues
1. Johnson’s algorithm is applied to the graph below. Give the modified weight of the edge (1,3) _ 4 + (-5) – (-1) = 0 __ The shortest path from 7 to 1 is (enumerate nodes) __ 7,5,6,4,3,2,10,9,1 __. 4. -1. 1. 3. 5. 3. 2. -2. 2. 1. 1. -2. -1. 2. 4. 6. -2. 2. 2. 1. 3.
E N D
1. Johnson’s algorithm is applied to the graph below. Give the modified weight of the edge (1,3) _4 + (-5) – (-1) = 0__ The shortest path from 7 to 1 is (enumerate nodes) __7,5,6,4,3,2,10,9,1__ 4 -1 1 3 5 3 2 -2 2 1 1 -2 -1 2 4 6 -2 2 2 1 3 -1 1 -2 -1 1 7 9 10 8
2. Use dynamic programming find longest common subsequences of the following two sequences x and y: ___________________ Show all details, and circle the resulted subsequence letters. (20pts.) y B E A B E A x 0 0 0 0 0 0 0 B 0 E 0 D 0 E 0 A 0
3. (10pts) Given 3 points with their Cartesian coordinates A=(645,763), B=(478,529), C=(937,1187) , D=(637,600) Give the final content of the stack in Graham’s algorithm for convex hull for these 4 points A, B and C (check the order!):
4. Below given a point set in the Euclidean metric. Draw 10 points • - Voronoi regions (dashed edges) • - Voronoi graph / Delanau triangulation (solid edges) • - minimum spanning tree (double edges)
5. Below given a point set in the octilinear metric (the height/width of any cell=1) where the closest pair of points should be found using divide and conquer. Show • - the first partition of the point set (draw a line) • the closest pair in the left part (connect solid), left= _______ , • and the right part (connect solid), right= _______ • the middle strip (shade) • pairs in the middle strip for which distances should be computed (connect dashed) • closest pair in the middle strip (connect solid) (20pts)
6 . In the RECTILINIAR metric for points given below find: a) the MST, its length is ___21____ c) the Cristofides tour is (enumerate points in visited order) __1,2,7,8,c,8,9,d,e,b,a,9,5,6,5,4,3,1_________________ d) its length is __30__ b) the 2-MST tour, is (enumerate points in visited order) _1,2,7,8,c,8,9,a,b,e,d,e,b,a,9,5,6,5,4,3,4,5,9,8,7,2,1___ 1 1 2 3 2 3 4 4 5 6 5 6 7 7 8 9 a 8 9 a c b c b d e d e e) the Optimal tour (enumerate points in visited order) ____1,2,7,8,c,d,e,b,a,9,a,6,5,4,3,1________________ f) its length is _26_ g) the minimum Steiner Tree, its length is _20_ 1 1 2 3 2 3 4 4 5 6 5 6 7 7 8 9 a 8 9 a c b c b d e d e
3 6 8 7 2 1 9 5 4 10 • 7. For minimum vertex cover problem in the following graph give • greedy solution = nodes __________________________________ • 2-VC solution = nodes __________________________________ • Optimal solution = nodes__________________________________ • Write an ILP which will solve the problem: 1 11 6 2 3 18 7 4 15 5 12 8 16 17 9 14 10 13
8. For the 3-CNF • f = (x’ +y+z)& (x+y’+z’)&(x+y+z’)& (x’+y’+z)&(x’+y+z’) &(x’+y’+z’) • give 0-1 assignment to variables such that f=1 __________________ • give 0-1 assignment to variables such that f=0 __________________ • Draw the corresponding graph and mark the maximum independent set
9. In the following graph list the vertices in • Maximum Independent Set___________________________ • Maximum clique___________________________ • Write an ILP for both problems: 2 3 16 6 1 4 5 10 2 13 17 4 12 7 18 5 11 8 9 3 14 1 15 8 7 6 9
10. Draw a stable marriage. Will Susan Susan Diana Kimiko Ryan Will Gordon Ryan Diana Kimiko Susan Diana Will Gordon Ryan Gordon Kimiko Susan Kimiko Diana Gordon Ryan Will