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
lions [1.4K]
3 years ago
13

What are the advantages and disadvantages of solving a problem that can be broken down into repetitive tasks with recursion as o

pposed to a loop? Explain your answer.
Computers and Technology
1 answer:
lesantik [10]3 years ago
3 0

Answer:

Answered below

Explanation:

Recursion refers to the process of a function calling itself within its own definition. It calls itself repeatedly until a base condition is met and the loop breaks.

The advantages of recursion over loops include;

A) Recursion reduces time complexity.

B) Recursion is better at tree traversal and graphs.

C) Recursion reduces the time needed to write and debug code and also adds clarity to code.

Disadvantages of recursion include;

A) Recursion uses more memory because each function call remains in stack until the base case is met.

B) Recursion can be slow.

C) Recursion

You might be interested in
Suppose you with had two algorithms, A and B, with growth functions fa(n)=200n2 and fb(n)=2n4. If you were to do an exact analys
anyanavicka [17]

Answer:

For values when n<32 use fb(n) else use fa(n).

See explaination for details

Explanation:

Earlier when n=1 fa(n)=2000 while fb(n)=2. for n=2 fa(n)=2000*22 =2000*4=8000 while fb(n)=2*24=2*16=32. It is observed that fa(n) requires more time than fb(n) for small values.

Now, we will see when fb(n) crosses fa(n). This can happen only when fb(n) values equals or greater than fa(n)

therefore,

2000n2<=2n4

Solving equation we get n2>=1000 which can happen when n>=32.

So for values when n<32 use fb(n) else use fa(n)

7 0
3 years ago
The text between and defines the _____.
Genrish500 [490]
Active text on a page
5 0
2 years ago
A 10 Superscript negative 910−9​-F capacitor ​(11 nanofaradnanofarad​) is charged to 5050 V and then disconnected. One can model
vredina [299]

Answer:

Explanation:

i) On a cold day, Capacity = (66 X 910 X 10∧-9) F

Charge, Q = (66 X 910 X 10∧-9) X 5050 = 0.30 Columb

Current, I= 5050/131013 = 0.039 Amp (where Resistance = 131013 ohms)

Time, t= 0.30/0.039 = 7.7 seconds

ii) On a humid day, Capacity = (77 X 910 X 10∧-9) F

Charge, Q = ( 77 X 910 X 10∧-9) X 5050 = 0.35 Columb

Current, I= 5050/6106 = 0.83 Amp ( where Resistance = 6106 ohms)

Time, t= 0.35/0.83 = 0.42 h or  0.42 X 60 mins = 25 mins

7 0
3 years ago
Bargain Bob's auto dealership sells vehicles. He sells Chrysler, Jeep, and Dodge brand vehicles. He tracks customer and manufact
marusya05 [52]

Answer:

Customer(1) - (1) Vehicle.

Explanation:

Cardinality is the mapping of entities or group of entities to a cardinal value. It tries to show the relationship between two objects like a cups in a shelf or plates in racks.

The car dealer in the question, sells one car to a customer and keep or prioritise the record of the main owner of the acquired vehicle. So the maximum cardinality assignment of the customer and vehicle is one (1) to one (1) mapping.

6 0
2 years ago
What is operating system​
iren [92.7K]

Answer:

It's simply a software that runs a computer's basic tasks, or functions, such as scheduling, running applications, and controlling peripherals.

3 0
2 years ago
Read 2 more answers
Other questions:
  • Let's say you're creating a search stream in your hootsuite dashboard, to find mentions of the phrase vacation holiday getaway.
    15·1 answer
  • What is the output of the second println statement in the main method? public class Foo { int i; static int s; public static voi
    14·1 answer
  • Is it necessary that every autonomous system use the same intra-AS routing algorithm? Why or why not?
    10·1 answer
  • Deciding whether to explode a process further or determine that it is a functional primitive is a matter of experience, judgment
    8·1 answer
  • 1. ___________ ensures the integrity and security of data that are passing over a network.
    13·1 answer
  • Create a do-while loop that asks the user to enter two numbers. The numbers should be added and the sum displayed. The loop shou
    5·1 answer
  • Which item is most important for a successful website design?
    6·2 answers
  • Password is an example of an authentication mechanisms that is based on " what an entity has".
    6·2 answers
  • Open the NetBeans IDE and create a new project named MySizes.java. Your program should do the following:
    9·1 answer
  • What is data science?​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!