This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CPSC 320 Sample Midterm 1 February 2009  1. Answer each of the questions with either true or false . You must justify each of your answers; an answer without a justification will be worth at most 1.5 out of 4.  a. If we can use the Master theorem to determine the solution to a recurrence relation, then we can also obtain that solution by drawing the corresponding recursion tree. Solution : This is true: we proved the Master theorem by drawing a recursion tree (Lemma 1), and then evaluating the resulting summation.  b. Let f, g be two functions from N into R + . Assuming that lim n →∞ f ( n ) /g ( n ) exists, we can use its value to determine whether or not f is in O ( g ) . Solution : This is true: if lim n →∞ f ( n ) /g ( n ) = 0 then f ∈ o ( g ) , and hence f ∈ O ( g ) . If lim n →∞ f ( n ) /g ( n ) is a positive real number, then f ∈ Θ( g ) and so f ∈ O ( g ) . Finally if lim n →∞ f ( n ) /g ( n ) = + ∞ then f ∈ ω ( g ) , and therefore f / ∈ O ( g ) .  c. In class, we proved an Ω( n log n ) lower bound on the worst-case running time of any algorithm that can be used to sort a sequence of n values. This is false: we only proved an Ω( n log n ) lower bound on the worst-case running time of any comparison sort. We did not prove that there isn’t some other type oftime of any comparison sort....
View Full Document
- Fall '10
- Recurrence relation, Divide and conquer algorithm, Master Theorem, recursion tree