{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# M01B - Spring 2007 CSE310 Midterm Examination 01B(in class...

This preview shows pages 1–4. Sign up to view the full content.

Spring 2007 CSE310 Midterm Examination 01B (in class) Instructions: There are five problems in this paper. Please use the space provided (below the ques- tions) to write the answers. Budget your time to solve various problems (roughly 15 minutes for each problem) and avoid spending too much time on a particular question. This is a closed book examination. You may not consult your books/notes. NAME ASUID Question Score P1 P2 P3 P4 P5 Total 0

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

View Full Document
Problem 1B. (20 points: 4 + 4 + 4 + 4 + 4) Use O , Ω, or Θ to relate each of the following pairs of functions. In particular, you need to write your answer as f ( n ) = O ( g ( n )), f ( n ) = Ω( g ( n )), or f ( n ) = Θ( g ( n )). In case f ( n ) = Θ( g ( n )), you will not receive credit if you write f ( n ) = O ( g ( n )) or f ( n ) = Ω( g ( n )), although both are implied by f ( n ) = Θ( g ( n )). 1. f ( n ) is the average case time complexity of mergesort for sorting n elements. g ( n ) is the average case time complexity of quicksort for sorting n elements. f ( n ) = Θ( g ( n )). Grading is binary. 2. f ( n ) is the worst case time complexity of mergesort for sorting n elements. g ( n ) is the worst case time complexity of quicksort for sorting n elements. f ( n ) = O ( g ( n )). Grading is binary. 3. f ( n ) = n X i =1 i ( i + 1) , g ( n ) = n 3 + n X i =1 i 2 i . f ( n ) = Θ( g ( n )). Grading is binary. 4. f ( n ) = n n , g ( n ) = 2 n × 3 n . f ( n ) = Ω( g ( n )). Grading is binary. 5. f ( n ) = n X i =1 n i , g ( n ) = n 1 . 0001 . f ( n ) = O ( g ( n )). Grading is binary. 1
Problem 2B. (20 points: 5 + 5 + 5 + 5) There are two algorithms A 1 , A 2 , with time complexities T 1 ( n ) , T 2 ( n ), respectively. We know that T 1 ( n ) = 10 T 1 ( n/ 3) + n 3 ; T 2 ( n ) = 16 T 2 ( n/ 3) + n 2 .

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}