why you need a base case.pdf - Consider the recurrence...

This preview shows page 1 out of 1 page.

Consider the recurrence relationan+1=an+ 52Without a base case we can argue that this sequence is both increasing and decreasing.IncreasingLet’s assume thatak< ak+1, doing some basic algebra we get thatak< ak+1ak+ 5< ak+1+ 5ak+ 52<ak+1+ 52ak+1< ak+2So it looks like it’s always increasing for allk.DecreasingLet’s now assume thatak> ak+1then by the same sequence of steps we can arrive atak> ak+1ak+ 5> ak+1+ 5ak+ 52>ak+1+ 52ak+1> ak+2So it seems that it’s always decreasing, hmmmm....Base CaseWhat’s going on? The truth is that this sequence does both depending on your basecase.If you start with

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture