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]
4 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]4 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
(TELL ME WHY PLEASE!! THANK YOU!!)
Jobisdone [24]
I would say D because in order to be flexible you have to be able to work around or with something in orded for it to still work hope this helped!!
4 0
4 years ago
Read 2 more answers
The indent buttons on the home tab allow you to increase or decrease paragraph indenting in increments of ____ inches.
TEA [102]
<span>0.5 inches.
You may also manually set the indentation. In order to do this, click the "Page Layout" tab and enter the desired values in the boxes under "Indent". The indentation of a text is the distance it has from the left margin (when writing from left to right).</span>
3 0
3 years ago
Isabella is a security support manager for a large enterprise. In a recent meeting, she was asked which of the standard networki
HACTEHA [7]

Answer:

A. Router

Explanation:

4 0
3 years ago
Which line of code will only allow a non-decimal point to be stored in a variable? candyCost = float(input("How much is the cand
ad-work [718]

Answer:

candyCost = int(input("How much is the candy?"))

Explanation:

candyCost = input("How much is the candy?") → By default, this how you get input and store the value. And it is stored as a string

candyCost = str(input("How much is the candy?")) → This also gives you a string to store

candyCost = float(input("How much is the candy?")) → This gives you a float number, decimal number, to store

candyCost = int(input("How much is the candy?")) → This gives you an integer number, a non-decimal

4 0
3 years ago
Read 2 more answers
Write a function that accepts an int array and the array’s size as arguments. 1. The function should create a new array that is
Contact [7]

Answer:

The question seems to be incomplete. Analyzing the full question the answer has been explained below. Please let me know if your answer requirement was other than this.

Explanation:

#include<iostream>

#include<fstream>

using namespace std;

int *extend(int arr[], int N)

{

  // create a new array that is twice

  //the size of the argument array.

  int *new_arr = new int[2 * N];

  int i;

  // copy the contents of the argument

  //array to the new array

  for (i = 0; i < N; i++)

      new_arr[i] = arr[i];

  // initialize the unused elements

  //of the second array with 0

  for (i = N; i < 2 * N; i++)

      new_arr[i] = 0;

  // return a pointer to the new array

  return new_arr;

}

//main function

int main()

{

  // Declare the array

  int N;

  //Prompt and reads an integer N

  cout << "Enter N : ";

  cin >> N;

  // If the integer read in from

  //standard input exceeds 50 or is less than 0

  if (N < 0 || N > 50)

      // The program terminates silently

      exit(0);

  // open file in read mode

  ifstream in("data.txt");

  // create an array of size N

  int *arr = new int[N];

  int i;

  // reads N integers from a file

  //named data into an array

  for (i = 0; i < N; i++)

  {

      // read integer from file

      in >> arr[i];

  }

  //then passes the array to your

  //array expander function

  int *new_arr = extend(arr, N);

  // print the extended array

  for (i = 0; i < 2 * N; i++)

      cout << new_arr[i] << endl;

  in.close();

  return 0;

}

4 0
3 years ago
Other questions:
  • Why did LISD had to block the game “among us”?
    8·2 answers
  • The key invention that enabled computers to go into every home and office is
    7·1 answer
  • 11) Write the definition for a child class of Circle named Cylinder. The cylinder should have a double attribute named height. T
    12·1 answer
  • A(n) monitoring vulnerability scanner is one that listens in on the network and determines vulnerable versions of both server an
    7·1 answer
  • How to import any csv from internet in phyton 3 and R ?
    12·1 answer
  • Two words are a ""reverse pair"" if each is the reverse of the other. Write a program that finds all the reverse pairs in the wo
    12·1 answer
  • A certain computer can be equipped with 268,435,456 bytes of memory. Why would a manufacturer choose such a peculiar number inst
    12·1 answer
  • Which administrative tool can you use to check your computer's health or troubleshoot problems with the operating system or soft
    11·2 answers
  • HELP WILL GIVE BRAINLIEST !!!!!
    6·1 answer
  • Will this website ever get itself together to stop people from sending links?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!