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
coldgirl [10]
3 years ago
9

what is the difference between recursion and iteration in C, and their advantages and disadvantages? ...?

Computers and Technology
1 answer:
madam [21]3 years ago
7 0

I think both recursive and iteration are different programming approaches which have their own benefits and drawbacks .

<span><span>Recursive approach: In recursive approach the function calls itself until the condition is met. And it is slower than iteration,which means it uses more memory than iteration. recursion is like a selection structure, and which makes code smaller and clean. And a function partially defined by itself. Here tracing the code will be more difficult in the case large programs.</span><span><span>Iterative approach: </span>Iterative approach is a repetition process until the condition fails,here loops are used such as for ,while etc. Here code may be longer but it is faster than recursive. And it consumes less memory compared to recursive approach.If the loop condition is always true in such cases it will be an infinite loop.</span></span>
You might be interested in
What is the use of an NDP?
Makovka662 [10]

Answer:

It defines five ICMPv6 packet types for router solicitation,router advertisement,neighbor solicitation,neighbor advertisement,and network redirects.

Explanation:

8 0
3 years ago
Consider a network of 8 routers connected together to provide more than one path of connectivity between host A and host B at tw
ser-zykov [4K]

Answer:

Option C is the correct option to the following question

Explanation:

Because there are not any limits is required of sending data and packets between host A and host B by the routers and the router permit more than one paths between the hosts for the establishment of the connectivity st two distinct locations in the routing protocol. The router transmits the packets between the hosts that is produced by link-state protocol.

5 0
3 years ago
Write a program that displays, 10 numbers per line, all the numbers from 100 to 200 that are divisible by 5 or 6, but not both.
FromTheMoon [43]

Answer & Explanation:

To print 10 on a line and each number separated by space; you make the following modifications.

print(str(i)+" ",end=' ')

str(i)-> represents the actual number to be printed

" "-> puts a space after the number is printed

end = ' ' -> allows printing to continue on the same line

if(count == 10):

     print(' ')

The above line checks if count variable is 10;

If yes, a blank is printed which allows printing to start on a new line;

The modified code is as follows (Also, see attachment for proper indentation)

count = 0

for i in range(100,201):

     if(i%6 == 0 and i%5!=0) or (i%5 ==0 and i%6!=0):

           print(str(i)+" ",end=' ')

           count = count + 1

           if(count == 10):

                 print(' ')

                 count = 0

7 0
4 years ago
Marianne needs to create a version of her slide presentation that does not include all the slides and will be used for
Morgarella [4.7K]

Answer:

B is the correct answer because that's what I do

8 0
3 years ago
Read 2 more answers
Is the hacker group project zorgo real or fake
Charra [1.4K]

It is real I hoped this help you

4 0
3 years ago
Read 2 more answers
Other questions:
  • Binary search requires that data to search be in order. true or false
    5·1 answer
  • Text filters allow you to create a custom filter to match ________ the text in a field that you specify.
    7·1 answer
  • What is the first thing you should do when creating a spreadsheet
    5·1 answer
  • __________ describes a module for which the software developer does not care how the processing is performed, but instead, knows
    7·1 answer
  • You are looking for ways to pay your higher education costs.Which of the following options will require you to pay back any mone
    6·1 answer
  • The sales of last 6 months are stored in a list,
    12·1 answer
  • PLEASE HELP WHATS THE ANSWER
    11·2 answers
  • Is this really a American Server ???
    14·1 answer
  • describe the role and importance of computers in New Media. Prepare a report on increasing interest and impact of mobile phones
    9·1 answer
  • Cisco cyber security would classify this email?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!