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
alekssr [168]
3 years ago
5

Is recursion ever required to solve a problem? What other approach can you use to solve a problem that is repetitive in nature?

Computers and Technology
1 answer:
Setler79 [48]3 years ago
8 0

Answer:

No you can not tell that recursion is ever required to solve a problem.

Recursion is required when in the problem, the solution of the input depends on the solution of the subsets of the input.

Iteration is also another form of repetitive approach we follow to solve that kind of problems.

But the difference between recursion and iteration is :

  • In recursion we call the function repeatedly to return the result to next level.
  • In iteration certain bunch of instructions in a loop are executed until certain conditions met.

Explanation:

For example in the Fibonacci sequence problem, to find f_{n}, we need to compute f_{n-1} and f_{n-2} before that.

  • In case of recursion we just call the method Fibonacci(n) repeatedly only changing the parameter Fibonacci(n-1), that calculates the value and return it.

                           Fibonacci(n)

                           1. if(n==0 or n==1)

                           2.       return 1.

                           3.else

                           4.      return( Fibonacci(n-1)+Fibonacci(n-1) )

  • But in case of iteration we run a loop for i=2 to n, within which we add the value of current f_{i-1} and f_{i-2} to find the value of f_{i}

                           Fibonacci(n)

                           1. if(n<=2)

                           2.    result = 1

                           3.     else

                           4. result1 =1 and result2=1.

                           5.      {  result = result1 +result2.

                           6.         result1= result2.

                           7.         result2 = result.

                           8.      }

                           9.  output result.

You might be interested in
Where should you click to edit an existing formula?
user100 [1]

Answer:

You can edit the existing formula by clicking the cell in which formula is referenced, then edit the formula in the formula bar. (option c is correct)

Explanation:

This question is about how to edit the existing formula. In Excel, you can edit the formula. First, you have to click the cell in which the formula is written. Then you have to edit it in the formula bar. However, if you know and remember the formula, you can edit directly in the cell. But the best practice is to edit the formula in the formula bar.

Why other options are not correct.

  • In a cell that is referenced in the formula:

The cell that is referenced in the formula does not affect the formula. Because to edit something in the referenced cell, does not guarantee to affect the formula that you want to edit. To edit the existing formula, you click the cell in which formula is written, then edit it in the formula bar.

  • In the first blank cell of the worksheet

It is not necessary, that there would be a formula in the first cell. But, if there is a formula in the first cell, you should edit the formula directly in the formula bar.

  • In the status bar

You can't edit the existing formula in the status bar because the status bar is used for showing the status of actions you are doing in excel. The status bar is shown at the bottom of the excel sheet.

3 0
3 years ago
Read 2 more answers
sharon gives a thumbs-up to her little brother who has just scored in his schools basketball game. sharon is communicating by us
stellarik [79]
She is communicating by using a gesture...
Please mark as brainliest...
6 0
4 years ago
Read 2 more answers
Susan wants to play the games that come with Windows on her computer, but they are not on the Start menu. What should she do in
ollegr [7]

Answer:

Search for the games in the search bar

Explanation:

5 0
2 years ago
What is the purpose of copyfitting?
stiv31 [10]

Answer:

ms word can help you to writer and print

ur document and make u more attractive

Explanation:

a

3 0
3 years ago
Print("Weight on Earth?")
Lynna [10]

Answer:

weightEarth = float(input("Enter weight on earth: "))

weightMoon = weightEarth/6

print("Weight on moon:", weightMoon)

Explanation:

You have to convert the string input into a float in order to do calculations with it.

5 0
2 years ago
Other questions:
  • End-user development: the process by which an organization's non-it specialists create software applications.
    8·1 answer
  • Write the pseudocode for linear search, which scans through the sequence, looking for ν. Using a loop invariant, prove that your
    14·1 answer
  • Două numere a și b sunt numite generatoare ale unui număr natural n dacă a∙b+[a/b]=n, unde s-a notat cu [c] partea întreagă a nu
    7·1 answer
  • Analyze the following code. Number[] numberArray = new Integer[2]; numberArray[0] = new Double(1.5); Question 9 options: A) Sinc
    13·1 answer
  • Consider a satellite orbiting the earth. Its position above the earth is specified in polar coordinates. Find a model-view matri
    12·1 answer
  • What can you find the under the privacy policy section of a shopping website?
    12·1 answer
  • If a fire should break out in your building, which of the following actions is NOT recommended?
    10·2 answers
  • A TCP ________ segment is a request to the other transport process to close a connection. ACK FIN SYN CLS
    15·1 answer
  • Decision support systems help managers use structured data to identify problems and find solutions to business-related problems.
    10·1 answer
  • Assume that students in a course are required to produce a written report on an ICT-related
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!