Algorithm


Meaning and Definition:

The word “Algorithm, is a distortion of “al-khwauizmi”, a Persian mathematician who wrote an influential treatise about algebraic methods. But the algorithm is a Latin word called “algouismus” which means “calculation methods”

An algorithm is a sequence of finite instructions often used for calculations and data processing.  It is a type of effective method in which a list of well-defined instructions for completing a task will, when given an initial state, proceed through a well-defined series of successive states, eventually terminating in an end state.

When the user is telling the computer what to do, he also gets to choose how it is going to be done.

To make a computer do anything, we have to write a computer program.

To write a computer program, we must tell the computer, step by step, exactly what we want it to do. The computer then “exceeds the program, following each step mechanically, to accomplish the end goal”.

An algorithm is a specific set of instructions for chalking out a procedure or solving a problem, usually requiring the procedure to terminate at some point.

An algorithm basically refers to the logic of the program. It is a step-by-step description of how to arrive at the solution to a given problem.


Characteristics of Algorithm:

  1. Finiteness: Terminates after a finite number of steps. The total number of steps used in the algorithm should be finite.
  2. Definiteness: Rigorously and unambiguously specified.
  3. Input: Valid inputs are clearly specified.
  4. Output: Can be designed to produce the correct output given a valid input. The algorithm must accept zero or more input and must produce at least one output.
  5. Effectiveness: Steps are sufficiently simple and basic.

Consider one basic example of tea making procedure (for 2 persons); only we put it step by step;

Step 1:   Take one bowl and add one cup of water and one cup of milk.

Step 2:  Start the gas and put the bowl on the gas.

Step 3:   Add 2 teaspoons of sugar.

Step 4:   Add 1 teaspoon of tea powder.

Step 5:   Wait five minutes till the tea is boiling.

Step 6:   Serve filter tea by off the gas.

We compare the above algorithm with the properties of the algorithm,

  • Finiteness: Above example has 6 simple steps
  • Definiteness: in the algorithm perfect measurement is given like 1 teaspoon, one cup, five minutes, etc.
  • Effectiveness: If we cannot perform any one of the above steps, we drink something else rather than tea, just like we miss the first step we get smoke in the kitchen, if we miss the second step we get cold tea, and so on.
  • Inputs:  Water, milk, tea powder, sugar, gas
  • Output: Hot tea


Advantages (Uses)

·                We use our traditional language like English, for developing it.

·                It is very easy to write.

·                Easy technique to understand the logic.

·                Easily identification of mistakes by a non-computer person.


Disadvantages (Limitations)

·                Time-consuming.

·                Difficult to show branching and looping.

·                Big tasks like simulation jobs, are difficult to put in the algorithm.


Examples

(1) Algorithm for the addition of two numbers.

Step 1: Start

Step 2: Read two numbers as 'a' and 'b'.

Step3: c = a + b

Step 4: Print addition as 'c'

Step 5: Stop


The above algorithm has properties like;

  1. Finiteness: The above algorithm has limited steps i.e. only 5 steps
  2. Definiteness: The algorithm required only two inputs which are stated in the question. Not more than that values are required.
  3. Effectiveness: Once we take inputs, we directly proceed for addition and after that print the generated output. (i.e. addition)
  4. Input: Two numbers (In the example 'a' and 'b')
  5. Output: Addition of two numbers (In the example 'c')

Comments

Popular posts from this blog

Introduction to Problem Solving

Steps in Problem Solving