mid1solnsFall2010 - CMPS 101 Algorithms and Abstract Data...

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

View Full Document Right Arrow Icon
CMPS 101 Algorithms and Abstract Data Types Fall 2010 Midterm Exam 1 Solutions 1. (20 Points) Prove that )) ( ) ( ( )) ( ( )) ( ( n g n f O n g O n f O = . In other words, if )) ( ( ) ( 1 n f O n h = and )) ( ( ) ( 2 n g O n h = , then )) ( ) ( ( ) ( ) ( 2 1 n g n f O n h n h = . Proof: Assume )) ( ( ) ( 1 n f O n h = and )) ( ( ) ( 2 n g O n h = . Then there exist positive constants 2 1 2 1 , , , n n c c such that for all 1 n n : ) ( ) ( 0 1 1 n f c n h , and for all 2 n n : ) ( ) ( 0 2 2 n g c n h . Let ) , max( 2 1 0 n n n = . Then both inequalities hold when 0 n n . Multiply the two inequalities to get ) ( ) ( ) ( ) ( 0 2 1 2 1 n g n f c c n h n h . Let 2 1 c c c = . Observe that c , and 0 n are positive, and ) ( ) ( ) ( ) ( 0 2 1 n g n cf n h n h for all 0 n n , showing that )) ( ) ( ( ) ( ) ( 2 1 n g n f O n h n h = , as required. /// 2. (20 Points) Use Stirling’s formula, to prove that ( ) n n n log ) ! log( Θ = . Proof:
Background image of page 1

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

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

This note was uploaded on 11/10/2010 for the course COMPUTER S 101 taught by Professor Patricktantalo during the Fall '10 term at University of California, Santa Cruz.

Page1 / 3

mid1solnsFall2010 - CMPS 101 Algorithms and Abstract Data...

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