Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Data Structures I - Recursion Homework 5, Wentworth Institute of Technology, Spring 2007, Assignments of Data Structures and Algorithms

Information about homework 5 for the data structures i course offered by wentworth institute of technology in the spring of 2007. The homework assignment focuses on recursion and implementing ackermann's function. Instructions for the assignment, due date, and contact information for the instructor. Extra credit is offered to students who add a static variable to count the number of times the function is called.

Typology: Assignments

Pre 2010

Uploaded on 08/19/2009

koofers-user-zps
koofers-user-zps 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Wentworth Institute of Technology
Division of Professional and Continuing Studies
COMP380 Section 71 - Data Structures I - Spring, 2007
Homework 5 – Recursion
Instructor: Bob Goldstein (617) 912-2512
bob.goldstein@schepens.harvard.edu
http://home.comcast.net/~goldsteinr/Courses/index.html
http://goldstein.eri.harvard.edu/courses/index.html
http://myweb.wit.edu/goldsteinr/Courses/index.html
Due Date: February 27,2007
Hand In: Printout of program code and dialogue of how it runs.
Purpose:
Purpose: Practice Recursion
(This is problem E3 on Page 121 of Kruse, Tondo and Leung)
Ackermann's function, defined as follows, is a standard device to determine how well recursion is
implemented on a computer.
A(0,n) = n+1 for n
0
A(m,0) = A(m-1,1) for m>0
A(m,n) = A(m-1, A(m,n-1)) for m>0 and n>0
Write a program to implement this function and test it for the following values of m and n.
A(0,0) A(0,9) A(1,8) A(2,2) A(2,0)
A(2,3) A(3,2) A(4,2) A(4,3) A(4,0)
NOTE – A(4,2), A(4,3) and A(4,0) WILL GIVE TROUBLE. THEY MIGHT CAUSE YOUR
COMPUTER TO HANG. If this occurs, please hand in the rest and state in your homework what
happened with these cases.
Extra Credit:
Put a static variable into your program to count the number of times the function is called.
As well as printing the value of the function, print out the number of times the function called
itself to do the calculation
/app/work/qkd9j0-466412-2765033-homework5-doc.doc 1 12/2/2020 12/2/2020

Partial preview of the text

Download Data Structures I - Recursion Homework 5, Wentworth Institute of Technology, Spring 2007 and more Assignments Data Structures and Algorithms in PDF only on Docsity!

Wentworth Institute of Technology

Division of Professional and Continuing Studies

COMP380 Section 71 - Data Structures I - Spring, 2007

Homework 5 – Recursion

Instructor: Bob Goldstein (617) 912- bob.goldstein@schepens.harvard.edu http://home.comcast.net/~goldsteinr/Courses/index.html http://goldstein.eri.harvard.edu/courses/index.html http://myweb.wit.edu/goldsteinr/Courses/index.html Due Date: February 27, Hand In: Printout of program code and dialogue of how it runs. Purpose: Purpose: Practice Recursion (This is problem E3 on Page 121 of Kruse, Tondo and Leung) Ackermann's function, defined as follows, is a standard device to determine how well recursion is implemented on a computer. A(0,n) = n+1 for n0 A(m,0) = A(m-1,1) for m> A(m,n) = A(m-1, A(m,n-1)) for m>0 and n> Write a program to implement this function and test it for the following values of m and n. A(0,0) A(0,9) A(1,8) A(2,2) A(2,0) A(2,3) A(3,2) A(4,2) A(4,3) A(4,0) NOTE – A(4,2), A(4,3) and A(4,0) WILL GIVE TROUBLE. THEY MIGHT CAUSE YOUR COMPUTER TO HANG. If this occurs, please hand in the rest and state in your homework what happened with these cases. Extra Credit: Put a static variable into your program to count the number of times the function is called. As well as printing the value of the function, print out the number of times the function called itself to do the calculation /app/work/qkd9j0-466412-2765033-homework5-doc.doc 1 12/2/2020 12/2/