

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Exam; Professor: Pruhs; Class: ALGORITHM DESIGN; Subject: Computer Science; University: University of Pittsburgh; Term: Fall 2003;
Typology: Exams
1 / 2
This page cannot be seen from the preview
Don't miss anything!


CS 1510 Midterm 2 Fall 2003
(a) Write a recursive function to compute T (i, j) in the naive way. Don’t forget the base case(s). (b) Show that if you implement this recursion directly in say the C programming language, that the program could use time that is exponential in n. (c) Write iterative array based code to compute T (m, n) that runs in O(n^2 ) time. (d) Write code to actually find the longest common subsequence from your array.
20 + 60 + (.4)(200) + 200 + 100 + 500 + (.5)(200) + (.5)(600)
Euros. Give an O(n^3 ) time algorithm for problem. Significant partial credit will be given for any polynomial time algorithm.
∑m i=1 D[i, ji]. An assignmentA^ is temporally consistent if^ ji^ ≤^ ji+1, for 1^ ≤^ i < m. In other words, if xi is assigned to some image yji then the next image in the sequence xi+ must be assigned to an image appearing no earlier that yji in the Y image sequence. (This makes sense, as time runs forward for both cameras.) We allow two images of X to be as- signed to the same image of Y. The problem is: given the video sequences X, Y and the cost table D[i, j], compute the minimum cost temporally consistent assignment of X to Y. Consider the following table for m = 3 and n = 6:
D[i, j] j = 1 j = 2 j = 3 j = 4 j = 5 j = 6 i = 1 3 7 4 9 1 2 i = 2 5 4 2 5 8 6 i = 3 6 1 5 8 2 7
If x 1 is assigned to y 1 (that is j 1 = 1) and x 2 is assigned to y 3 (that is j 2 = 3), and x 3 is assigned to y 6 (that is j 3 = 6) then the cost of this assignment is D[1, 1]+D[2, 3]+D[3, 6] = 3+2+2 = 7. Give an O(n^3 ) time algorithm to compute the lowest achievable cost. Significant partial credit will be given for any algorithm with polynomial running time.