algorithms




What is Algorithm?

  • An algorithm is a sequence of well-defined instruction for completing a task or solving a problem.

  • It can be describe in a natural language, pseudo code, a flowchart or even a programming language.

  • An algorithm is any well-defined computational procedure that take some value, or set of value, as input and produces some value, or set of values as output.

example:-

 step 1- Start 

Start 2- Declare three integers a, b and c.

Step 3- define values of a & b.

Step 4- Add values of a & b.

Step 5- Store output of step 4 to  c.

Step 6- Print c.

Step 7- Stop.



Characteristics of algorithm:-

  • It is general English language written in steps to justify the program objective which can easily be understood by a beginner.
  • It is no more program code what creates the complexity to read and write the program any more.
  • Program control is always in from Top-to-Bottom approach unless any diversity of steps is executed.
  • It is independent of programming languages; no more depending upon a programming language hence can be used and designed for a program of any programming language.

Advantages of algorithm:-

  • It is easy to understand and it facilitates step-by-step solution to a given problem.
  • It has got definite procedure.
  • It easy to first developer and algorithm, and then convert it into a flowchart and then into computer program.
  • It is independent of programming language.
  • it is easy to debug as every step is got its own logical sequence.