Homework 3, Homework 3, Homework 3, ....

Short Description:

Write a series of recursive programs or programs that explore recursion.

This assignment is worth 15 points.

Goals

When you finish this homework, you should:

Formal Description

Please perform the following tasks.
  1. [5 points] Starting with the code in fibonacci.C.

  2. [5 points] Implement Ackermann's Function.. This function is historically important in that it demonstrated a new class of functions. Don't worry about understanding the function, just identify the base case and the recursive cases and implement the code. Demonstrate that your implementation is correct by printing a table similar to this table. Please limit 0 ≤ m ≤ 3 and 0 ≤ n ≤ 4.

    Example Output

     m\n |     0    1    2    3    4
    -----+--------------------------
       0 |     1    2    3    4    5
       1 |     2    3    4    5    6
       2 |     3    5    7    9   11
       3 |     5   13   29   61  125
    
    setw and setfill might be very helpful producing this table.

  3. [5 points] Implement a recursive function that checks to see if a string is a perfect palindrome. Write a main routine to test your function. This routine should open a file, read this file one line at a time, print the line in quotes and "YES!" if the line represents a perfect palindrome and "no." otherwise. One answer per line. The program should prompt for the file name and produce errors consistent with those in assignment two.

    Example Output

    Enter the file name => example.in
    
    "racecar" YES!
    "god saw I was dog" YES!
    "I did, did I?" no.
    "Able was I ere I saw Elba." no.
    "A man, A plan, A canal: Panama!" no.
    "Madam, I'm Adam." no.
    "Hello World!" no.
    "spam" no.
    

    Discussion

    Required Files

    All work should be contained in a single directory, with a Makefile, source code and README file.

    Submission

    Please create a tar file your solution directory and submit it to your instructor as an attachment to an email message.