Header Ads

1.0 - Algorithm

Algorithm:
  • A procedure or formula for solving a problem
  • A sequence of unambiguous instructions for solving a problem, i.e., for obtaining a required output for any legitimate input in a finite amount of time.
Use of Algorithm:
Algorithms is needed to generate correct output in finite time in a given constrained environment
  • Achieve Correctness of output
  • Finite time
  • For Better Prediction
Ways of Writing a Algorithm:
  • Natural Language
  • Pseudo Codes
  • Flowcharts.. etc,..
Example for Algorithm:
Let's consider a problem of adding 2 integer numbers
The steps involved :
  • Start
  • Read the value of A and B
  • Add A and B and store in SUM
  • Display SUM
  • Stop
The above 5 steps would eventually will give us the expected result.

Logical Algorithm:
Let's consider a problem of adding two number.
The steps involved :
  • BEGIN
  • Read A, B
  • SUM = A + B
  • Print SUM
  • END
The above 5 steps would eventually will give us the expected result.


...

No comments