comp250_midterm2

comp250_midterm2 - Computer Science 308-250B Midterm...

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

View Full Document Right Arrow Icon
Computer Science 308-250B Midterm, Feb 20, 2002, 18:30-19:30. S O L U T I O N S
Background image of page 1

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

View Full DocumentRight Arrow Icon
Computer Science 308-250B Midterm, Feb 20, 2002, 18:30-19:30. O P E N • B O O K S •/• O P E N • N O T E S 1) Show the following (and justify your steps) a) n 1000 is O(n n ) For n>1000000 we have that n >1000. Therefore, for all n>1000000 we have n 1000 < n n . By definition this means n 1000 is O(n n ). b) n+n log n+7 is Ω ( n log(log n) ) We actually show “n log(log n) is O(n 2 +n log n+7)” and conclude “n 2 +n log n+7 is Ω (n log(log n) )” since f(n) is O(g(n)) if and only if g(n) is Ω (f(n)) by definition. To prove this, first notice 2 a,b a+b a*b since 1/a 1/2 1-1/b thus 2 x,b x*b = a+b+b+…+b a*b*b*…*b = b x where a = x-floor(x-2) log(log n) is O(log n) using rule 10 n log 2 n is O(n 2 ) (*) using rule 6 and then, n 2 < n 2 +n log n+7, for all n>0 (since n log n +7 > 0) n 2 is O(n 2 +n log n+7) (**) by definition. Therefore, using (*), (**) and rule 3, n log
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/01/2009 for the course COMP COMP 250 taught by Professor Blanchette during the Spring '04 term at McGill.

Page1 / 4

comp250_midterm2 - Computer Science 308-250B Midterm...

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

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