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
balu736 [363]
3 years ago
10

Consider the following recursive method: public int someFun(int n) { if (n <= 0) return 2; else return someFun(n-1) * someFun

(n-1); } (a) When the program calls someFun(5), how many times will someFun(3) be called? (b) What does this method calculate when the input parameter n is a non-negative integer?
Computers and Technology
1 answer:
Stella [2.4K]3 years ago
3 0

Answer:

(a) someFunc(3) will be called 4 times.

(b) For non negative number n someFunc method calculates 2^2^n.

Explanation:

When you call someFunc(5) it will call someFunc(4) two time.

So now we have two someFunc(4) now each someFunc(4) will call someFunc(3) two times.Hence the call to someFun(3) is 4 times.

someFunc(n) calculates someFunc(n-1) two times and calculates it's product.

someFunc(n) = someFunc(n-1)^2..........(1)

someFunc(n-1)=someFunc(n-2)^2..........(2)

substituting the value form eq2 to eq 1.

someFunc(n)=someFunc(n-2)^2^2

       .

       .

       .

       .

= someFunc(n-n)^2^n.

=2^2^n

2 raised to the power 2 raised to the power n.

You might be interested in
The blank contains the computer's brain the central processing unit CPU
Ipatiy [6.2K]

The central processing unit (CPU), also called a processor, is located inside the computer case on the motherboard. Hope it helps (:

6 0
3 years ago
NO SPAMMERS, ONLY FULL ANSWER
melisa1 [442]

Answer:

true

Explanation:

4 0
3 years ago
Read 2 more answers
The macro command is available on the ___ tab<br> Home<br> Insert<br> View<br> Design
nataly862011 [7]

      Answer                     : Insert tab                                              

5 0
3 years ago
Read 2 more answers
Design an algorithm that will prompt for and receive pairs of numbers from an operator at a terminal and display their sum, prod
Andrews [41]

Explanation:

The Program is written in Python

7 0
2 years ago
Which of the following is used to describe the information used in
aniked [119]

Answer:

D.

Explanation:

Clipher

You can read the instructions

3 0
3 years ago
Other questions:
  • If you are going to attach more than 15 devices to your wireless network, you should make sure your router supports which standa
    14·1 answer
  • Explain why computer users should use the cloud?
    14·1 answer
  • In Python please:
    15·1 answer
  • A strategy to solve a logic problem is to break it into steps. Using the drop-down menu, complete these sentences about solving
    15·2 answers
  • Papa Mario of Mario's Pizzeria has baked a huge pizza and cut it into n slices, but he is clumsy and the pizza wasn't evenly sli
    14·1 answer
  • They convert energy from the Sun into usable chemical energy by the process of photosynthesis. They are
    11·1 answer
  • Which of the following correctly shows the general structure of a for-each loop header?for (initialization; condition; increment
    9·1 answer
  • I NEED an example of output plssss​
    13·1 answer
  • 1. Assuming you are downloading a 100MB (800Mb) file on a Network that can download data at 54Mbps.
    15·1 answer
  • What is the relationship between hardware and software technology tools?
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!