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
Help!!! Photography class!! ASP
katovenus [111]

Answer:

D.

Explanation:

Typically represented by a capital A (or sometimes Av, short for Aperture Value) on the camera mode dial, aperture priority allows the photographer to dial in this specific exposure setting—the ƒ-stop—and asks the camera to calculate the correct corresponding shutter speed in the instant before the shutter is released.

8 0
3 years ago
Consider a class ClassName whose methods are listed below. What class is it?
Varvara68 [4.7K]

Answer:

An implementation of java.util.List interface

Explanation:

Given class consists of the following constructs:

  • Constructor
  • isEmpty,search, display
  • insert,remove

It supports inserting and removing an element at a specified index. It also supports search and display operations.

These are characteristics of an object which implements the java.util.List interface ( For example: ArrayList or user-defined customList ).

8 0
3 years ago
25 Points!
neonofarm [45]

Answer:

I believe the answer is D. var = var + 1

Explanation:

5 0
3 years ago
Two technicians are discussing ASE certification. Technician A says that there are 60-plus exams each designed to discern the au
babunello [35]
TECHNICIAN B is the one who is right. ASE is and acronym for Automotive Service Excellence. ASE is a professional certification group which certified professionals in the automotive repair industry. To qualify to take their test, one must have at least two years on the job experience, because the exam questions are job related. There are 40 plus exams and each is designed to test the professionals' knowledge of job related skills.   
6 0
3 years ago
Read 2 more answers
Create a class Cola Vending Machine. This class is simulating a cola vending machine. It keeps track of how many cola bottles ar
vodka [1.7K]

Answer:

public class CocaColaVending {

   private int numBottles;

   private double costPerBottle;

   public CocaColaVending(int numBottles, double costPerBottle) {

       this.numBottles = numBottles;

       this.costPerBottle = costPerBottle;

   }

   public int getNumBottles() {

       return numBottles;

   }

   public void setNumBottles(int numBottles) {

       this.numBottles = numBottles;

   }

   public double getCostPerBottle() {

       return costPerBottle;

   }

   public void setCostPerBottle(double costPerBottle) {

       this.costPerBottle = costPerBottle;

   }

   public void sellBottles(int numSold){

       int remainingStock = this.numBottles-numSold;

       setNumBottles(remainingStock);

   }

   public void restockBottles(int numRestock){

       int newStock = this.numBottles+numRestock;

       setNumBottles(newStock);

   }

}

THE TEST CLASS IS showing the functionality of the class is given in the explanation section

Explanation:

public class CocaColaVendingTest {

   public static void main(String[] args) {

       CocaColaVending vending = new CocaColaVending(1000,2.3);

              System.out.println("Intial Stock "+ vending.getNumBottles());

       vending.sellBottles(240);

       System.out.println("After Selling 240 bottles "+ vending.getNumBottles());

       vending.restockBottles(1000);

       System.out.println("After restocking 1000 bottles "+ vending.getNumBottles());

   }

}

5 0
3 years ago
Other questions:
  • __________ ensures that the individual is who they claim to be (the authentic or genuine person) and not an imposter.
    15·1 answer
  • Explain about RDBMS. Include advantages/ disadvantages. Compare DBMS vs RDBMS. Explain about Oracle as well.
    14·2 answers
  • Which key is used in word processors to create indentations?
    13·2 answers
  • An organizational structure that combines a functional structure with a divisional structure to emphasize project or program nee
    8·1 answer
  • Which of the following is similar to defense in depth and supports multiple layers of security?a. Defense in depthb. Diversity o
    7·1 answer
  • Select the correct answer.
    10·2 answers
  • 1. What was the very first “photo-realistic CGI character” to appear on-screen in a movie (released in 1985)?
    8·2 answers
  • Which statement is true about hacking?
    11·2 answers
  • Please help it’s timed
    5·1 answer
  • What type of trust model is used as the basis for most digital certificates used on the internet?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!