CSE 131 Module 2: Recursion


Read this before starting:

Studio Sessions Overview:

The results of your studio session are to be reported and documented in a file that you save in your workspace. You are to print and turn in one copy of that report for your group. In the descriptions of the studio exercises, verbs like report and document are indications of activities you should summarize and discuss in your report.

In your groups, take turns documenting results, looking over shoulders, and staffing the keyboard.

It is unacceptable to copy anything without understanding it. At any point, the TA or instructor can point to something you've done and ask you why it works, or change it and ask what would happen with the modification.



Part 1

Pick one of these following, or do both if you have interest:
  1. Here is a simple but interesting recursive function.
       f(x) =    x-10     if x > 100
            = f(f(x+11))  if x <= 100

  2. Here is another interesting recursive gunction:
      g(x,y)  = y+1               if x = 0
              = g(x-1,1)          if x > 0 and y = 0
              = g(x-1, g(x, y-1)) if x > 0 and y > 0

Part 2

Consider the picture below.

Submitting your work (read carefully)

Last modified 22:14:02 CST 11 November 2009 by Ron K. Cytron