Write a method to recursively computer ackermann function

Assignment Help Computer Engineering
Reference no: EM132077781

You need help with this part 1 and 2, please

The Ackermann Function

Part 1

The Ackermann function is a function created by Wilhelm Ackermann in the late 1920s. For non-negative integers m and n, the Ackermann function is defined as

A(m,n)= n+1 if m=0

A(m,n) = A(m-1,1) if m>0 and n=0

A(m,n)= A(m-1, A(m,n-1)) if m>0 and n>0

Write a method to recursively computer the Ackermann function. Note that the Ackermann function grows extremely quickly for even small values of m and n. Test your method with the following values but be aware that if m is greater than 3 and n is greater than 1, it will take a very long time to compute.


n

m

0

1

2

3

4

5

6

7

8

9

10

0

1

2

3

4

5

6

7

8

9

10

11

1

2

3

4

5

6

7

8

9

10

11

12

2

3

5

7

9

11

13

15

17

19

21

23

3

5

13

29

61

125

253

509

1021

2045

4093

8189

Part 2: 

Write a recursive method called writeNums that takes an integer n as a parameter and prints to the console the first n integers starting with 1 in sequential order, separated by commas. For example, consider the following calls:

writeNums(5);    // would produce 1, 2, 3, 4, 5

writeNums(12);   //would produce 1, 2, 3, 4, 5, 6, 7, 8, 8, 10, 11, 12

Reference no: EM132077781

Questions Cloud

Define and test these two python functions : Define and test these two Python functions. You must use recursion to define them: you are not allowed to use loops or local variables.
Make an interface that allows the user to search for an item : Make an interface that allows the user to search for an item with a nice background photo.
Create an account object and make sure it has values : Create an Account object and make sure it has values for all its instance variables. Similarly, you can use hard-code parameter values.
What is the maximum profit : How many pounds of each blend should she make to maximize profits? What is the maximum profit?
Write a method to recursively computer ackermann function : Write a method to recursively computer the Ackermann function. Note that the Ackermann function grows extremely quickly for even small values of m and n.
Find the first derivative of f(x) : Let f(x)=e^e^x. Answer the following questions. 1. Find the first derivative of f(x).
Write a program that reads the data from the file produced : Write a program that reads the data from the file produced in Part A, and produces a report showing the courses taught .
Create a customer object and make sure it has values for all : Define Customer.java according to the following class diagram and information. Define Account.java according to the following class diagram.
Find out the prime numbers from a given range of numbers : Write a program called PRIME2 to find out the prime numbers from a given range of numbers (for ex: from 1 to 50) using for loop.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd