This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CS570 Analysis of Algorithms Fall 2008 Exam I Name: _____________________ Student ID: _________________ ____Monday Section ____Wednesday Section ____Friday Section Maximum Received Problem 1 20 Problem 2 10 Problem 3 10 Problem 4 20 Problem 5 20 Problem 6 20 Total 100 2 hr exam Close book and notes 1) 20 pts Mark the following statements as TRUE or FALSE . No need to provide any justification. [ TRUE/FALSE ] F Given graph G and a Minimum Spanning Tree T on G , you could find the (weighted) shortest path between arbitrary pair u, v in V(G) using only edges in T . [ TRUE/FALSE ] F V 2 log V = θ (E logE 2 ) whether the graph is dense or sparse. [ TRUE/FALSE ] T If DFS and BFS returns different trees, then the original graph is not a tree. [ TRUE/FALSE ] T An algorithm with the running time of n * 2 min(n log n, 10000) runs in polynomial time. [ TRUE/FALSE ] T We may need to run Dijkstra’s algorithm to compute the shortest path on a directed graph, even if the graph doesn't have a cycle. [ TRUE/FALSE ] F Given a graph that contains negative edge weights, we can use Dijkstra's algorithm to find the shortest paths between any two vertexes by first adding a constant weight to all of the edges to eliminate the negative weights. [ TRUE/FALSE ] F If f(n) and g(n) are asymptotically positive functions, then f(n)+g(n) = θ( min{f(n),g(n)}). [ TRUE/FALSE ] F For a stable matching problem such that m ranks w last and w ranks m last, m and w will never be paired in a stable matching. [ TRUE/FALSE ] F Breadth first search is an example of a divideandconquer algorithm. [ TRUE/FALSE ] T Kruskal's algorithm for finding the MST works with positive and negative edge weights. 2) 10 pts a) Arrange the following in the increasing order of asymptotic growth. Identify any ties. lg n 10 , 3 n , lg n 2n , 3n 2 , lg n lg n , 10 lg n , n lg n , n lg n Solution: The order is lg n 10 , lg n lg n , lg n 2n , n lg n , 3n 2 , 10 lg n , n lg n , 3 n Where lg n 2n and n lg n ties b) Analyze the complexity of the following loops: i x = 0 for i=1 to n x= x + lg n end for O(n) ii x=0 for i=1 to n for j=1 to lg n x = x * lg n endfor endfor O(nlgn) iii x = 0 k = “some constant” for i=1 to max (n, k) x= x + lg n end for O(n) iv x=0 k = “some constant” for i=1 to min(n, k) for j=1 to lg n x = x * lg n endfor endfor O(lgn) 3) 10 pts a) For each of the following recurrences, give an expression for the runtime T (n) if the recurrence can be solved with the Master Theorem. Otherwise, indicate that the Master Theorem does not apply....
View
Full Document
 Spring '08
 SHAHRIARSHAMSIAN
 Algorithms, LG, service time

Click to edit the document details