2008+CS+361+midterm

2008+CS+361+midterm - CS 361 Midterm Exam. Tuesday, October...

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

View Full Document Right Arrow Icon
CS 361 Midterm Exam. Tuesday, October 21, 2008 Put your name in the top-right corner of each page! Write your answers in the space provided. Be concise! There are 6 problems, each worth 20 points. 1. (20 points) For each of the following, determine whether f ( n ) is O ( g ( n )), Ω( g ( n )), Θ( g ( n )) or none of the above. Justify your answers. (a) f ( n ) = 10 6 n , g ( n ) = n 2 2 (b) f ( n ) = n log n , g ( n ) = (log n ) n (c) f ( n ) = 2 log n , g ( n ) = n 3 (d) f ( n ) = n 2 (log n ) 5 , g ( n ) = n 3 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
2. (20 points) Suppose f,g,h are functions such that f ( n ) = O ( h ( n )) and g ( n ) = O ( h ( n )). Answer the following questions. Prove your answers. (a) What is the best that can be said about the sum f + g ? (b) the product fg ? (c) the difference f - g ? (d) True or false: f g = O ( h h ). 2
Background image of page 2
3. (20 points) Consider the following algorithm. mystery(A): /* takes an array of integers as input */ Let n denote length(A) for i = 1 to n for j = i+1 to n if A[j] < A[i] swap A[i] and A[j]
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

2008+CS+361+midterm - CS 361 Midterm Exam. Tuesday, October...

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

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