Lab 02 - Debugging
Thanks for my Lab Tutor Zhang Puyu!
Last updated
Thanks for my Lab Tutor Zhang Puyu!
Last updated
Slides:
Before we talk about the wishful thinking, let's get a quick review of the Mathematical Induction
Suppose we want to find the value of for any non-negative interger , we only need to do two things:
Find .
Find a way to get based on the value of .
The so called "Wishful Thinking" is just the reverse of above!
Suppose we already know:
How to compute using ;
The value of , i.e., "the base case" (or terminating condition)
Now we want to find , and so we can just find first. To find , we just need to find first... the cycle goes on until we reach where the recursion terminates.