CSE 260SOLUTIONS TO YELLOW QUIZ 9Spring 20071. [7 points] Letcnbe the number of ways you can climb a staircase ofnstairs if you can climb two or threestairs with each step that you take. Thus, for example,c1= 0 andc2= 1. Write a recurrence relation forcnand use it to find how many ways there are to climb a staircase of 20 stairs.Show your work neatly.Forn≥4, your trip up the staircase can consist of a first step that climbs two stairs followed by any ofthecn-2ways of climbing the remaining stairs, or a first step that climbs three stairs followed by any ofthecn-3ways of climbing the remaining stairs. Since there is no way to climb one stair and one way toclimb two or three stairs, we have the following recurrence relation and initial conditions.c1= 0, c2= 1, c3= 1,andcn=cn-2+cn-3forn≥4n1234567891011121314151617181920cn0111223457912162128374965861142. [7 points] On the homework, you analyzed a modified Tower of Hanoi problem in which a disk can only be
This is the end of the preview.
access the rest of the document.