09.12.2012 Views

Concrete mathematics : a foundation for computer science

Concrete mathematics : a foundation for computer science

Concrete mathematics : a foundation for computer science

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

18 RECURRENT PROBLEMS<br />

Homework exercises<br />

8 Solve the recurrence<br />

Q o = 0~; QI = B;<br />

Q n = (1 + Qn-l)/Qn-2, <strong>for</strong> n > 1.<br />

Assume that Q,, # 0 <strong>for</strong> all n 3 0. Hint: QJ = (1 + oc)/(3.<br />

9 Sometimes it’s possible to use induction backwards, proving things from<br />

n to n - 1 instead of vice versa! For example, consider the statement<br />

now that’s a<br />

horse of a different<br />

color.<br />

P(n) : x1 . . .x, 6<br />

x1 +. . . + x, n<br />

) , ifxr ,..., x,30.<br />

( n<br />

This is true when n = 2, since (x1 +xJ)~ -4~1x2 = (x1 -xz)~ 3 0.<br />

a By setting x,, = (XI + ... + x,~l)/(n - l), prove that P(n) implies<br />

P(n - 1) whenever n > 1.<br />

b Show that P(n) and P(2) imply P(2n).<br />

C Explain why this implies the truth of P(n) <strong>for</strong> all n.<br />

10 Let Q,, be the minimum number of moves needed to transfer a tower of<br />

n disks from A to B if all moves must be clockwise-that is, from A<br />

to B, or from B to the other peg, or from the other peg to A. Also let R,<br />

be the minimum number of moves needed to go from B back to A under<br />

this restriction. Prove that<br />

Qn= ;;,,,+l<br />

{ ,<br />

0<br />

;;;,;i Rn= d +Qnp,+,, ;;;,;’<br />

, i n<br />

(You need not solve these recurrences; we’ll see how to do that in Chapter<br />

7.)<br />

11 A Double Tower of Hanoi contains 2n disks of n different sizes, two of<br />

each size. As usual, we’re required to move only one disk at a time,<br />

without putting a larger one over a smaller one.<br />

a How many moves does it take to transfer a double tower from one<br />

peg to another, if disks of equal size are indistinguishable from each<br />

other?<br />

b What if we are required to reproduce the original top-to-bottom<br />

order of all the equal-size disks in the final arrangement? [Hint:<br />

This is difficult-it’s really a “bonus problem.“]<br />

12 Let’s generalize exercise lla even further, by assuming that there are<br />

m different sizes of disks and exactly nk disks of size k. Determine<br />

Nnl,. . . , n,), the minimum number of moves needed to transfer a tower<br />

when equal-size disks are considered to be indistinguishable.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!