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
Lorico [155]
3 years ago
15

The way most recursive functions are written, they seem to be circular at first glance, defining the solution of a problem in te

rms of the problem itself ("A rose is a rose is a rose"). For example, a recursive function to compute the factorial of n might look like this:
Engineering
1 answer:
EastWind [94]3 years ago
6 0

Question Continuation

int factorial(int n) {

if(n == 0)

return 1;

else

return n * factorial(n - 1);

}

Provide a brief explanation why this recursive function works.

Show all steps involved in calculating factorial(3) using the function defined.

Answer:

1. Brief explanation why this recursive function works.

First, the recursive method factorial is defined.

This is the means through with the machine identifies the method.

The method is defined as integer, the machine will regard it as integer.

When the factorial is called from anywhere that has access to it, which in this case is within the factorial class itself. This means you can call it from the main method, or you can call it from the factorial method itself. It's just a function call that, well, happens to call itself.

2. Steps to calculate factorial(3)

1 First, 3 is assigned to n.

2. At line 2, the machine checks if n equals 0

3. If yes, the machine prints 1

4. Else; it does the following from bottom to top

factorial(3):

return 3*factorial(2);

return 2*factorial(1):

return 1;

Which gives 3 * 2 * 1 = 6

5. Then it prints 6, which is the result of 3!

You might be interested in
This is it dont anwser this is for my other account
Nezavi [6.7K]

Answer:

thanks for the poiunts

Explanation:

6 0
3 years ago
How do we find percentage error in measuring voltage across a resistor​
Black_prince [1.1K]

Answer:

  use the percentage error relation

Explanation:

The percentage error in anything is computed from ...

  %error = ((measured value)/(accurate value) -1) × 100%

__

The difficulty with voltage measurements is that the "accurate value" may be hard to determine. It can be computed from the nominal values of circuit components, but there is no guarantee that the components actually have those values.

Likewise, the measuring device may have errors. It may or may not be calibrated against some standard, but even measurement standards have some range of possible error.

6 0
3 years ago
Read 2 more answers
Gear A has a mass of 1 kg and a radius of gyration of 30 mm; gear B has a mass of 4 kg and a radius of gyration of 75 mm; gear C
Kruka [31]

Answer:

(4.5125 * 10^-3 kg.m^2)ω_A^2

Explanation:

solution:

Moments of inertia:

I = mk^2

Gear A: I_A = (1)(0.030 m)^2 = 0.9*10^-3 kg.m^2

Gear B: I_B = (4)(0.075 m)^2 = 22.5*10^-3 kg.m^2

Gear C: I_C = (9)(0.100 m)^2 = 90*10^-3 kg.m^2

Let r_A be the radius of gear A, r_1 the outer radius of gear B, r_2 the inner radius of gear B, and r_C the radius of gear C.

r_A=50 mm

r_1 =100 mm

r_2 =50 mm

r_C=150 mm

At the contact point between gears A and B,

r_1*ω_b = r_A*ω_A

ω_b = r_A/r_1*ω_A

       = 0.5ω_A

At the contact point between gear B and C.

At the contact point between gears A and B,

r_C*ω_C = r_2*ω_B

ω_C = r_2/r_C*ω_B

       = 0.1667ω_A

kinetic energy T = 1/2*I_A*ω_A^2+1/2*I_B*ω_B^2+1/2*I_C*ω_C^2

                           =(4.5125 * 10^-3 kg.m^2)ω_A^2

6 0
4 years ago
Two uniformly charged conducting plates are parallel to each other. They each have area A. Plate #1 has a positive charge Q whil
Karo-lina-s [1.5K]

Answer:

E = \frac{3Q}{2A\epsilon_0}

Explanation:

By Gauss Law for electric field:

E = \frac{\sigma}{2\epsilon_0}

Where \sigma is the charge density Q/A. Since we have 2 parallel  plates with different charge, the electric field at point P in the gap would be the sum of 2 field

E = E_1 + E_2

E = \frac{Q}{2A\epsilon_0} + \frac{2Q}{2A\epsilon_0}

E = \frac{3Q}{2A\epsilon_0}

5 0
3 years ago
After a program has downloaded to a PLC, what must be selected?
Hitman42 [59]

Answer:

A driver is an independent software application that is used to configure communication between a personal or industrial computer and a hardware device

5 0
3 years ago
Other questions:
  • Identify factors that can cause a process to become out of control. Give several examples of such factors.
    7·1 answer
  • There are 30 students in a class. Choose the statement that best explains why at least two students have last names that begin w
    12·1 answer
  • 5) Two concentric spheres of diameter D1= 70 cm and D2= 120 cm are separated by an air space and have surface temperatures of T1
    13·1 answer
  • In your opinion, what is the external opportunity cost of a successful biking company in a community
    7·1 answer
  • Compute the longitudinal tensile strength of an aligned glass fiber-epoxy matrix composite in which the average fiber diameter a
    9·1 answer
  • Which of these is the coarsest grit abrasive that may be used on aluminum?
    15·2 answers
  • View the picture below and then correctly answer the questions using the following words: Temperate Zone, Tropical Zone, Polar Z
    6·2 answers
  • An engine jack is used to lift a 265-lb engine 6'. How much work, in ft-lb, is performed?
    11·1 answer
  • Which of the following is not an electronic device ?
    11·1 answer
  • Along with refining craft skills another way to increase the odds for career advancement is to
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!