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
Leonardo is having difficulty accessing the course website. he should contact the for assistance. (points:1)
Alona [7]
He should contact the teacher for assistance
3 0
2 years ago
 A programming paradigm is a method used to program a computer that guides the solving of a problem or performing of a task. Whi
kaheart [24]

The one that best describes the procedural or imperative, programming paradigm as it uses a linear, top-down approach to solving problems. The correct option is D.

<h3>What is a linear approach?</h3>

It describes a method of programming where an application is created by first defining at a high level what it should be able to accomplish, then breaking that down into smaller and smaller sections.

Without going into specifics about any of the system's components, the top-down model presents an overview of the whole. The definition is then progressively improved, detailing each element in more detail until it is complete enough to validate the model.

Therefore, the correct option is D. It uses a linear, top-down approach to solving problems.

To learn more about programming paradigm, refer to the link:

brainly.com/question/17150647

#SPJ1

8 0
1 year ago
Create a dictionary that maps a fruit name to its color. Both the keys and the values should be stored as strings. Include only
UkoKoshka [18]

Answer:

Written in Python:

fruit_dictionary = {}

fruit_dictionary = {'apple': 'red', 'orange': 'orange', 'banana': 'yellow'}

Explanation:

First (although, not necessary), we create an empty dictionary named fruit_dictionary on line 1

Next, we populate the dictionary using the following syntax:

{key-1:value-1, key-2:value-2,......,key-n:value-n}

In this case, the entry would be:

{'apple': 'red',

'orange': 'orange',

'banana': 'yellow'}

The items on the first column (i.e. apple, orange and banana) are the keys while the items on the second (i.e. red, orange and yellow) are the values of the dictionary

To print the items in the dictionary, you can add  the following line of code:

<em>print(fruit_dictionary.items()) </em>

6 0
3 years ago
Which of the following is the best name for a history report about world war 1
kolezko [41]

Answer: "World War-1: The War that Changed the Nation"

8 0
2 years ago
1.What is Intellectual Property
Akimi4 [234]
I think the answer for 1 is c but I am not sure
4 0
2 years ago
Other questions:
  • what aspect should you consider before adding pictures to a document? you should structure the first before you search for a rel
    15·2 answers
  • Digital dashboards provide the decision makers with a quick overview of key performance indicators and other key operational sta
    13·1 answer
  • The fossil record is usually incomplete due to the destruction of fossils.
    10·1 answer
  • "A ____ is a collection of hardware and other devices that are connected together so that users can share hardware, software, an
    5·1 answer
  • Downloading files is safe for most types of files except Select one: a. documents. b. pictures. c. executable files. d. music fi
    7·1 answer
  • how write a program to prompt the user for hours and rate per hour using input to computer gross pay Use 35 hours and rate2.75 p
    9·1 answer
  • The ____ attribute can be used only with input boxes that store text. Group of answer choices type pattern required value
    9·1 answer
  • New product ideas must fit into a company's mission statement and?
    12·1 answer
  • How do I contact an admin
    8·1 answer
  • Explain how mobile phone production could be more sustainable​
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!