What is Algorithm?

What is Algorithm?

An algorithm is defined as a step-by-step procedure or method for solving a problem. 

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

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

What we are doing is, for a given problem (preparing a bajji), we are providing a step-by-step procedure for solving it.

While defining an algorithm steps are written in human understandable language and independent of any programming language. We can implement it in any programming language of our choice. From the data structure point of view, following are some important categories of algorithms

  1. Sort – Algorithm to sort items in a certain order (Either Ascending/Descending order).
  2. Search – Algorithm to search an item in a data structure.
  3. Insert – Algorithm to insert item in a data structure.
  4. Update – Algorithm to update an existing item in a data structure.
  5. Delete – Algorithm to delete an existing item from a data structure.
Characteristics of an Algorithm

Not all procedures can be called an algorithm. An algorithm should have the following characteristicsΒ 

  1. Unambiguous – Algorithm should be clear and unambiguous. Each of its steps and their inputs/outputs should be clear and must lead to only one meaning.
  2. Effectiveness – An algorithm is also generally expected to be effective. This means that all of the operations to be performed in the algorithm must be sufficiently basic that they can in principle be done exactly and in a finite length of time.
  3. Input – An algorithm should have zero or more well-defined inputs.
  4. Output – An algorithm should have 1 or more well-defined outputs, and should match the desired output.
  5. Finiteness – Algorithms must terminate after a finite number of steps.
  6. Feasibility – Should be feasible with the available resources.
  7. Independent – An algorithm should have step-by-step directions, which should be independent of any programming code.

What is Algorithm?


Scroll to top