cs320-2008-t2-midterm1-solution

cs320-2008-t2-midterm1-solution - CPSC 320 Sample Midterm 1...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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 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

This note was uploaded on 10/09/2011 for the course CPSC 344 taught by Professor Karen during the Fall '10 term at UBC.

Page1 / 3

cs320-2008-t2-midterm1-solution - CPSC 320 Sample Midterm 1...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online