Sunday 5 April 2020

ALGORITHM

What is algorithm?
An algorithm may be defined as the step-by-step procedure or method that can be carried out for solving programming problems. Or an algorithm consists of a set of explicit and clear (only one meaning) finite steps, which when carried out for a given set of initial conditions, produce the corresponding output, and terminate in a fixed amount of time.
An algorithm tells computer how to solve problem systematically to get desired output. For example, algorithm to read user name from keyboard and say hello to user can defined as follows:

Step # 1: START
Step # 2: Read user name from keyboard
Step # 3: Store INPUT to NAME
Step # 4: Say hello to user
Step # 5: STOP

CHARACTERISTICS OF ALGORITHMS
  1. Problems should be solved in finite number of step by step
  2. Algorithms should be Simple and easy to read
  3. Problems should be solved in finite number of step-by-step direction.
  4. It should be universal and leads to a unique solution of the problems.
  5. It should be capable of handing exception.
  6. It should be precise and unambiguous.
  7. It should be provide result in finite amount of time.
  8. It must be complete and correct.
  9. Desired result must be obtained after execution.
HOW TO WRITE AN ALGORITHM?
There are different steps that should be in mind when you have to write algorithms for solving a particular type of problems.

STEPS TO WRITE ALGORITHMS

        Take input from the user. This input is processed in subsequent instruction in the algorithms.
1.      Process the input data entered by the user.
2.      Produce one or more output after processing.
3.      Show result.

CHECKING THE ALGORTHMS
To ensure the efficient execution of the program, it is necessary to check the algorithms before coding it. There are many different methods to check the algorithms. Some of them are.
1. DRY RUN: This is the manual way to examination the algorithms. In this method we find the value of each variable after every step of algorithm.

2. REVIEW: This method involves the studying the logic and computing it with a specification.

3. WALK THROUGH: In this method algorithm is present to the team member for checking the efficiency of the algorithms.

MERIT OF THE ALGORITHM
1.      Algorithm makes the program unambiguous mare understandable.
2.      With algorithm program are portable and efficient.
3.      It shows processing in easy step-by-step methods.
4.      Modification deletion and updation as the existing program is quite easy.
5.      It promotes testing of program at developing stage.
6.      Algorithm provides technique in program design on paper before it performs on computer.
7.      They are also useful to determination output by just giving input.
8.      They are quite useful to solve complex programming.

 SIX STEPS FOR PROBLEM ANALYSIS

  • Step One: Comprehend the Case Situation
  • Step Two: Defining the Problem
  • Step Three: Identify the causes
  • Step Four: Generating Alternative Solutions
  • Step Five: Decision
  • Step Six: Taking Action 

No comments:

Post a Comment