A good algorithm has at least the following properties:
- It solves the given problem
- It is precise and unambiguous i.e. it is obvious and totally clear what each instruction is meant to accomplish
- It is simple and detailed enough for a computer to follow
- It does what it is meant to do i.e. it works correctly
- It defines the correct order of execution
- It is finite. The algorithm must terminate after a finite number of operations
1. Sequence: The instruction must be followed in a given order.
2. Selection: Execution of the path of a part of the algorithm depends on the circumstances. Example: if... else.
3. Repetition(iteration): A part of the algorithm may be repeated several times.
No comments:
Post a Comment