Some Recursion Problems (and a Linked List One)

  1. The Fibonacci series is defined by the following formulae:

    Write a program to read an integer n and compute this sequence recursively..

  2. The Ackermann function A(m, n) is a mathematical function of some importance in theoretical computer science. It is commonly defined as:

    Please write a program that requests two nonnegative integers and computes A(m,n).
    Warning: Use small m and n. This function gets very large very fast.

  3. The program linked.c, presented in class and available on the web site, inserts items in to a linked list, in such a way that the list is sorted after each insertion. In that program is a function called insert() that inserts items into the list. It is not recursive. Rewrite it so it is recursive.

  4. At the end of that same program is code to print the list (lines 142–148). Write a recursive function to do the same thing, but recursively, and replace the code in that file with a call to your function.


UC Davis sigil
Matt Bishop
Office: 2209 Watershed Sciences
Phone: +1 (530) 752-8060
Email: mabishop@ucdavis.edu
ECS 36A, Programming & Problem Solving
Version of June 3, 2023 at 9:29PM

You can also obtain a PDF version of this.

Valid HTML 4.01 Transitional Built with BBEdit Built on a Macintosh