This preview shows pages 1–5. Sign up to view the full content.
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: UMass Lowell CS 91.503 Fall, 2001 Name: ___________________________ MIDTERM EXAM + SOLUTIONS This exam is open: books notes and closed :  neighbors calculators The upper bound on exam time is 3 hours. Please write your name at the top of each page. Please put all your work on the exam paper. (Partial credit will only be given if your work is shown.) Good luck! (page 1 of 17) UMass Lowell CS 91.503 Fall, 2001 Name: ___________________________ PART I 91.404 Review (27 points) 1. (9 points) Function Order of Growth Given: 1) f 1 (n) is in Ω (n lg(lgn)) 2) f 2 (n) is in Ο (4 lgn ) 3) f 2 (n) is in Θ (f 3 (n)) 4) f 3 (n) is in Ω (n lg 2 n) (a) (3 points) Can we conclude from statements (1)(4) that f 3 (n) must be in Ο (n 2 ) ? Why or why not? Solution: YES. f 2 (n) is in Θ ( f 3 (n))> f 3 (n) is in Ο ( f 2 (n)) This, combined with f 2 (n) is in Ο (4 lgn ) implies (via transitivity) that f 3 (n) is in Ο (4 lgn ) . Now, observe that 4 lgn = 2 2lgn = 2 lg 2 n = n 2 . Thus, f 3 (n) is in Ο (n 2 ) . (b) (3 points) Can we conclude from statements (1)(4) that f 1 (n) must be in Ω ((2/5) n ) ? Why or why not? Solution: YES. f 1 (n) is in Ω (n lg(lgn)) implies f 1 (n) is in Ω (g(n)) for all g(n) smaller than nlg(lgn) . Now, observe that n lg(lgn)) is in Ω ((2/5) n ) since Ω ((2/5) n ) is <=1 for all positive n. This, combined with f 1 (n) is in Ω (n lg(lgn)) implies (via transitivity) that f 1 (n) is in Ω ((2/5) n ) . (c) (3 points) Can we conclude from statements (1)(4) that f 1 (n) must be in Ο (n lgn) ? Why or why not? Solution: NO. f 1 (n) is in Ω (n lg(lgn)) only provides a lower bound on f 1 (n) . n lgn is in Ω (n lg(lgn)). It is possible for f 1 (n) to be larger than n lgn ; for example, f 1 (n) = n 2 . In this case, f 1 (n) is not in Ο (n lgn) . (page 2 of 17) (2/5) n 4 lgn = n 2 n lg 2 n f 3 f 2 n lg(lgn) f 1 UMass Lowell CS 91.503 Fall, 2001 Name: ___________________________ 2. (9 points) Recurrence In this problem, you will find a closedform solution for the following recurrence: T(n) = T(n/4) + Θ (n) That is, you will find f(n) such that T(n) is in Θ (f(n)) . You may assume that: n = 4 k for some positive integer k T(1) = 1 (a) (3 points) Solve the recurrence using the Master Theorem. Solution: The recurrence is of the form T(n) = aT(n/b) + f(n) with a=1, b=4, and f(n)= Θ (n). Ratio test yields: This is case 3, so the solution is T(n) = f(n) = Θ (n). (page 3 of 17) ) ( 1 ) ( ) ( ) ( 1 log log 4 n n n n n n f a b Θ = Θ = Θ = UMass Lowell CS 91.503 Fall, 2001 Name: ___________________________ (b) (6 points) Solve the recurrence by building a recursion tree and finding a closedform solution of the resulting summation....
View
Full
Document
This note was uploaded on 02/13/2012 for the course CS 91.503 taught by Professor Staff during the Spring '11 term at UMass Lowell.
 Spring '11
 Staff

Click to edit the document details