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 [12] 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. [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. [4] 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 ) . [4] c. In class, we proved an Ω( n log n ) lower bound on the worstcase 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 worstcase 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
This note was uploaded on 10/09/2011 for the course CPSC 344 taught by Professor Karen during the Fall '10 term at UBC.
 Fall '10
 Karen

Click to edit the document details