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]
4 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]4 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
You can access your programs, your documents, your printer, even help from
nirvana33 [79]
 I think it's B. The Start menu.                  
3 0
3 years ago
Read 2 more answers
Which routine is configured to execute first when the program runs?
tester [92]
It's D because of ok
4 0
3 years ago
Martina is responsible for the installation and maintenance of both hardware and software that make up her company’s network. Sh
natali 33 [55]

Answer:

The answer is "network administrator"

Explanation:

A network manager is liable for the deployment, maintenance, and upgrade to any software or hardware required to operate a computer system effectively, In this post, Martina works as follows:  

  • She can be extended into a local area, wide area network, the network and web services via the IT or device network.
  • She addresses issues that occur in everyday usage and work on long-term initiatives like as information backup or network maintenance.
5 0
4 years ago
A(n) __________ consists of nonproprietary hardware and software based on publicly known standards that allows third parties to
Rus_ich [418]

Answer:

The answer is "Open System".

Explanation:

The term open system means a computing system, that integrated across software and hardware devices and provides complies with the same accessibility requirement.  

  • This connectivity and functionality mean, that a machine operating the Windows OS could be regarded as an open platform as can be seen by Windows being such a software OS.
  • It is composed of the non-owned development tool, which is based on publicly reported values, that enable service providers to generate attach-on to the system.
6 0
3 years ago
Use a dictionary to count the frequency of letters in the input string. Only letters should be counted, not blank spaces, number
netineya [11]

Answer:

def count_letters(text):

 result = {}

 # Go through each letter in the text

 convert_text = text.lower()

 for letter in convert_text:

   if letter.isalpha():

     if letter in result:

       result[letter] += 1

     else:

       result[letter] = 1

 return result

print(count_letters("AaBbCc"))

# Should be {'a': 2, 'b': 2, 'c': 2}

print(count_letters("Math is fun! 2+2=4"))

# Should be {'m': 1, 'a': 1, 't': 1, 'h': 1, 'i': 1, 's': 1, 'f': 1, 'u': 1, 'n': 1}

print(count_letters("This is a sentence."))

# Should be {'t': 2, 'h': 1, 'i': 2, 's': 3, 'a': 1, 'e': 3, 'n': 2, 'c': 1}

Explanation:

4 0
3 years ago
Other questions:
  • If you receive an increase in pay, how will that affect your payroll deductions?
    8·1 answer
  • The condition, ____, entered in the criteria row of a long text field in a query window would retrieve all records where the lon
    8·1 answer
  • The medium format camera uses ___ film
    7·1 answer
  • What protocol allows us to use a domain name like .com instead of an ip address?
    6·1 answer
  • How many electrons are there in an atom of carbon? A. Four B. Eight C. Six D. One
    15·2 answers
  • I need help in creating a Java Program; To calculate the chapter from which you solve the programming exercise, below are the re
    7·1 answer
  • Which type of storage disk and disk drive can be used in the given situation? Amy wants to borrow an interesting movie from Bruc
    10·2 answers
  • While approaching your parked car, the first step before getting in should be
    9·2 answers
  • Original phone call greeting for oncologist
    10·1 answer
  • Which of the following You tubers uses the word "flip" as a curse word
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!