Program 5 Recursion - Introduction to Computer Science II | CSI 1440, Assignments of Computer Science

Material Type: Assignment; Class: Introduction to Computer Science II with Laboratory; Subject: Computer Science; University: Baylor University; Term: Summer II 2005;

Typology: Assignments

Pre 2010

Uploaded on 08/16/2009

koofers-user-mnd
koofers-user-mnd 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CIS 1440 Program 5 Due 07/22/05
Recurrsion 23:59:59
In this assignment you will implement seven recursive functions, and print a table of their
values. Here are the functions.
1.
(
)
(0)0,()/21
ffxfx
==+


2.
(
)
(0)0,()/2
ffxfxx
==+


3.
(
(0)0,()2/21
ffxfx
==+


4.
(
)
(0)0,()2/2
ffxfxx
==+


5.
(0)0,()(1)1
ffxfx
==+
6.
(0)0,()(1)ffxfxx
==+
7.
(0)0,()2(1)1
ffxfx
==+
For each function evaluate it for all integer values from 0 through 20, and print the results
in a table. Line 1 has the value of each function at zero, Line 2 has the value of each
function at one, and so forth, until you have printed 21 lines. Set the width of the output
field to 8, so the numbers line up. This will be enough to give you a space between each
number, since the largest number will have 7 digits.

Partial preview of the text

Download Program 5 Recursion - Introduction to Computer Science II | CSI 1440 and more Assignments Computer Science in PDF only on Docsity!

CIS 1440 Program 5 Due 07/22/

Recurrsion 23:59:

In this assignment you will implement seven recursive functions, and print a table of their

values. Here are the functions.

f (0) = 0, f ( ) x = f x / 2 + 1  

f (0) 0, f ( ) x f x / 2 x

f (0) 0, f ( ) x 2 f x / 2 1

f (0) = 0, f ( ) x = 2 f x / 2 + x  

  1. f (0) = 0, f ( ) x = f ( x − 1) + 1
  2. f (0) = 0, f ( ) x = f ( x − 1)+ x
  3. f (0) = 0, f ( ) x = 2 f ( x −1) + 1

For each function evaluate it for all integer values from 0 through 20, and print the results

in a table. Line 1 has the value of each function at zero, Line 2 has the value of each

function at one, and so forth, until you have printed 21 lines. Set the width of the output

field to 8, so the numbers line up. This will be enough to give you a space between each

number, since the largest number will have 7 digits.