1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
marta [7]
3 years ago
7

Complete the following Programming Assignment using Recursion. Use good programming style and all the concepts previously covere

d. Submit the .java files electronically through Canvas by the above due date (In a zip file). This also includes: Requirements (for this problem), Pseudo-Code, UML, Java Doc(s) and an explanation, etc., which must be in the correct format. 9. Ackermann's Function Ackermann's function is a recursive mathematical algorithm that can be used to test how well a computer performs recursion. Write a method ackermann(m, n), which solves Ackermann's function. Use the following logic in your method: If m=0 then return n +1 If n = 0 then return ackermann (m - 1, 1) Otherwise, return ackermann (m - 1, ackermann(m, n - 1)) Test your method in a program that displays the return values of the following method calls: ackermann(0, 0) ackermann (0, 1) ackermann(1, 1) ackermann(1, 2) ackermann(1, 3) ackermann(2, 2) ackermann(3, 2)
Computers and Technology
1 answer:
Likurg_2 [28]3 years ago
6 0

Answer:

Explanation:

public class Ackermann {

   public static int ackermann's(int m, int n) {

       if (m == 0) {

           return n + 1;

       } else if (n == 0) {

           return ackermann's(m-1, 1);

       } else {

           return ackermann(m - 1, ackermann(m, n - 1));

       }

   }

   public static void main(String[] args) {

       System.out.println(ackermann(0, 0));

       System.out.println(ackermann(0, 1));

       System.out.println(ackermann(1, 1));

       System.out.println(ackermann(1, 2));

       System.out.println(ackermann(1, 3));

       System.out.println(ackermann(2, 2));

       System.out.println(ackermann(3, 2));

   }

}

1

2

3

4

5

6

7

29

Process finished with exit code 0

You might be interested in
How many bytes are in 1 kilobyte of storage
topjm [15]

Answer:

1000

Explanation I SEARCHED IT Up

5 0
3 years ago
A(n) ________ is a chart based on PivotTable data.
Mrrafil [7]
Well since it’s a chart based on a PivotTable prettyyyy sure it’s gonna be a PibltChart
7 0
2 years ago
Which action will help you protect data in your computer in case of an earthquake?
Len [333]

Answer:

Explanation: 13

8 0
3 years ago
Read 2 more answers
Who want followers on Instagram... gotta follow back
Alexxx [7]

Explanation:

I dont have Instagram....

6 0
2 years ago
Read 2 more answers
Due to a fire at ABC Software Solutions, all
zaharov [31]

Answer:

chaos among people who worked in the company.

6 0
1 year ago
Other questions:
  • An archive of files that usually contain scripts that install the software contents to the correct location on the system is ref
    11·1 answer
  • When saving a document or drawing, you determine the destination folder in which the file will be saved by?
    6·1 answer
  • Are mobile phones hazardous to your health?
    13·2 answers
  • What is another term for accountability?
    7·2 answers
  • Easter Sunday is the first Sunday after the first full moon of spring. To compute the date, you can use this algorithm, invented
    15·1 answer
  • An information system includes _____, which are programs that handle the input, manage the processing logic, and provide the req
    14·1 answer
  • Write a program that reads from a file called dictionary.txt which contains pairs of English and translated words separated by a
    12·1 answer
  • True or false?
    15·2 answers
  • Gta! ! ! !!aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    11·2 answers
  • What were the names of Henry VIII's six wives?
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!