What is the algorithm?

Data Structure >   Data Structure Introduction >   What is Algorithm  

Long Question

986


Answer:

Let us consider the problem of preparing an omelet. To prepare an omelet, we follow the
steps given below:

1) Get the frying pan.
2) Get the oil.
   a. Do we have oil?
       i. If yes, put it in the pan.
       ii. If no, do we want to buy oil?
           1. If yes, then go out and buy.
           2. If no, we can terminate.
3) Turn on the stove, etc...


What we are doing is, for a given problem (preparing an omelet), we are providing a step-by-step procedure for solving it. The formal definition of an algorithm can be stated as:
An algorithm is the step-by-step unambiguous instructions to solve a given problem. In the traditional study of algorithms, there are two main criteria for judging the merits of algorithms: correctness (does the algorithm give a solution to the problem in a finite number of steps?) and efficiency (how much resources (in terms of memory and time) does it take to execute them).

Note: We do not have to prove each step of the algorithm.


This Particular section is dedicated to Question & Answer only. If you want learn more about Data Structure. Then you can visit below links to get more depth on this subject.




Join Our telegram group to ask Questions

Click below button to join our groups.