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
A network administrator is examining a RIPv2 routing table and notices that several subnets are advertised in individual entries
Aleonysh [2.5K]

Answer:

B. Use the auto-summary command.

Explanation:

With the implementation of dynamic routing protocols, RIP summarizes networks at classful boundaries by default. To configure a router to automatically summarize networks, the auto-summary command would be used.

5 0
4 years ago
List three functions that you can perform with a database that you cannot perform with a spreadsheet.
Delicious77 [7]
There are some function which can be performed with database but not with a spread sheet, these functions include: 
1. Enforcement of data type.
2. Support for self documentation.
3. Defining the relationship among constraints in order to ensure consistency of data.
5 0
3 years ago
If the moon disappeared, what effect would this have on the Earth’s tides?
avanturin [10]
<span>There would no longer be any tides.< this seems like the most probable answer because there will be no gravitational pull from the moon that causes tides 
</span>
8 0
3 years ago
Choose the proper term to describe each of the following examples.
Lady_Fox [76]

Answer:first 1

Explanation:

4 0
3 years ago
Trish bought a new computer that she has been using for a few weeks. She is starting to experience pain in her wrists, back and
Ostrovityanka [42]

<span>Good Posture – Trish should look for a good ergonomic chair that will help with her aches.  She should identify her natural posture and memorize it.</span>

<span>Regular movement and work organization – Encourage regular breaks and stretch or walk around the office.  At least once an hour is recommended.</span>

Position of the screen – Trish should consider factors such as distance, height, and angle of the screen.






5 0
3 years ago
Read 2 more answers
Other questions:
  • The _____ unit is the preferred style unit for web page text because it makes it easy to develop pages in which different page e
    10·2 answers
  • Which of the following commands should you use to determine whether there are any shared resources on a Windows computer with th
    15·2 answers
  • Which of the following statements isNOT true about abstract data types (ADTs)?A list is anexample of an ADT.ADTs hide theimpleme
    7·1 answer
  • Explain how technology is related to human needs and wants?
    13·1 answer
  • a rule that states each foreign key value must match a primary key value in the other relation is called the
    5·1 answer
  • A program that will read each player’s name and golf score as keyboard input,
    9·1 answer
  • JOIN GO.OGLE CLASSROOM IF YOUR A FAN OF FRANK OCEAN
    15·2 answers
  • Quick!! Im taking a timed test so pls hurry!! Ill even mark as brainliets!!
    5·2 answers
  • Consider the following instructions for a game element: Move Forward If not at end, move forward Else stop This is an example of
    10·1 answer
  • What are the disadvantages of vector images when compared to bitmap images?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!