{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hw5solutions

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

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

SOLUTIONS TO HOMEWORK#5 (Total Point: 80) Section 3.1: 24 (points: 15), 56 (points :10) Total point:25

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

View Full Document
Section 3.2: 20 (points :10) , 22 (points :15) , 60 (points :10) Total point: 35
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,
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

{[ snackBarMessage ]}

### 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
Ask a homework question - tutors are online