CS210 Lab: Recursion Postlab
This postlab exercise is broken down into two parts.
- Part 1-general recursion question.
- Part 2-lab exercise specific question
Use the following function to answer Questions 1 and 2.
int Puzzle (int base, int limit)
if (base > limit)
if (base == limit)
return base* Puzzle(base+1, limit);
- Identify the following:
- the base case(s) of the function Puzzle
- the general (recursive) case(s) of the function
- Show what would be written by the following calls to the recursive
- cout << Puzzle(20,5);
- cout << Puzzle(3,6);
- cout << Puzzle(8,8);
This question is based on the lab exercise that you just completed.
Back to Recursion Lab click
- Another approach to recusively removing 'c' would be to
return an address of the next node in sequence (that isn't
In this case, you don't have to
pass by reference and the prototype will look
like the following:
template < class DT >
ListNode<DT> * List<DT>:: cRemoveSub ( ListNode<DT> *p )
Write the code to complete this function.
Copyright: Department of Computer Science, University of Regina.