week-5 - 1 HW1 - 2 All three statements were incorrect. a....

Info iconThis preview shows pages 1–5. 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

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: 1 HW1 - 2 All three statements were incorrect. a. if f ( n ) = O(F( n )) and g ( n ) = O(G( n )), then f ( n )/ g ( n ) = O( F( n )/G( n ) ) Counter-Example: f( n ) = n 3 F( n ) = n 3 n 3 = O( n 3 ) g( n ) = n G( n ) = n 2 n = O( n 2 ) f( n )/g( n ) = n 3 / n = n 2 F( n )/G( n ) = n 3 / n 2 = n n 2 O( n ) HW1 - 2 b. f ( n ) = O( g ( n )) implies that 2 f ( n ) = O(2 g ( n ) ) Counter-Example: f( n ) = 2 n g( n ) = n 2 n = O( n ) 2 2 n O(2 n ) HW1 - 2 c. For all functions f ( n ) and g ( n ), either f ( n ) = O( g ( n )) or g ( n ) = O( f ( n )) Counter-Example: NOT sin & cos, but partial credit was given for them because they have the right idea. Consider f( n ) = n if n is even; f( n ) = 2 n if n is odd. g( n ) = n 2 2 HW1 - 5 a . Estimate the total amount of money in an armored car completely full of $20 bill. Standard assumptions: Size and shape of the cargo area Size of a stack of $20 bills. Results: $18,000,000 $34,560,000 $42,000,000 $104,000,000 $145,152,000 $147,456,000 $165,888,000 $275,480,000 $829,440,000 HW1 - 5 b . Estimate how many cubic miles of water flow out of the mouth of the Mississippi River each day. Standard assumptions: Flow rate of river Size and shape of river mouth Results: 0.012 mi 3 /day 0.15 0.3 0.57 0.864 1.2 48 169.44 1188 Real Numbers? Width = 2,000-3,500 feet Depth 100 feet Speed = 2 miles per hour Width Depth Speed 24 hours/day 0.66 mi 3 /day Actual number is closer to 0.5 mi 3 /day, or 611,000 ft 3 /sec (My own approximation without looking anything up was 30 mi 3 /day) 3 HW1 - 5 c . Estimate the number lego blocks in a life-size replica of the Statue of Liberty. Standard assumptions: Size and shape of a brick Height, width and depth of statue (box assumed). Results: 588,144 777,600 938,667 1,170,000 35,280,000 500,000,000 1,042,000,000 11,000,000,000 13,824,000,000 Lego Liberty - real numbers Height = 152 2 (base to torch) Height = 305 1 (from foundation) Height = 111 1 (heel to head) Thickness at waist = 35 Average Lego (?) Lego Liberty - real numbers Lego Liberty Height = 29 tall Contains 2882 pieces Scale = 1522 / 29 = 55.3 Pieces = 2882 x 55.3 3 = 4.87 x 10 8 (487,000,000) 4 HW1 - 6 a . Show T( n ) = 2T( n /2 + 17) + n is O( n log n ) Assume T( n /2 + 17) c ( n /2 + 17) log ( n /2 + 17) Prove: T( n ) c n log n T( n ) 2( c ( n /2 + 17) log ( n /2 + 17)) + n 2( c ( n /2 + 17) log ( n /2 + 17)) + n (drop floors) 2( c ( n /2 + 17) log (3 n /4)) + n (for n > 68) = c ( n + 34) log (3 n /4) + n = c ( n + 34) (log n- log(4/3)) + n = c ( n log n- n log(4/3) + 34log n- 34log(4/3)) + n < c ( n log n- n log(4/3) + 34log n ) + n c n log n- c n log(4/3) + c 34log n + n c n log n- n + c 34log n ( c > 2/log(4/3)) c n log n HW1 - 6 a . Show T( n ) = 2T( n /2 + 17) + n is O( n log n ) Why cant we say: Assume holds for T( n /2 + 17) T( n ) 2( c (...
View Full Document

Page1 / 16

week-5 - 1 HW1 - 2 All three statements were incorrect. a....

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

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