hw5solutions

hw5solutions - so there are n multiplications and n...

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

View Full Document Right Arrow Icon
SOLUTIONS TO HOMEWORK#5 (Total Point: 80) Section 3.1: 24 (points: 15), 56 (points :10) Total point:25
Background image of page 1

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

View Full DocumentRight Arrow Icon
Section 3.2: 20 (points :10) , 22 (points :15) , 60 (points :10) Total point: 35
Background image of page 2
Section 3.3: 8, 26 (points :10 each) Total point:20 8 . a) Initially y:=3. For i=1 we set y to 3*2+1 = 7. For i=2 we set y to 7*2+1=15, and we are done. b) There is one multiplication and one addition for each of the n passes through the loop,
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: so there are n multiplications and n additions in all. 26 . Each iteration (determining whether we can use a coin of a given denomination) takes a bounded amount of time, and there are at most n iterations, since each iteration decreases the number of cents remaining. Therefore there are O(n) comparisons ....
View Full Document

This document was uploaded on 10/16/2010.

Page1 / 3

hw5solutions - so there are n multiplications and n...

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