PROGRAM DESIGN TOOL - ALGORITHM
- An algorithm is a Characteristics of an algorithm
- Well defined set of steps for solving a problem.
- Logical concise list of procedures for solving a problem
- Complete unambiguous finite number of logical steps for solving any problem on the computer
- Characteristics of an algorithm
- Precision - the steps are precisely defined.
- Uniqueness - results of each step are uniquely defined and only depend on the input and the result of the preceding steps.
- Finiteness - the algorithm stops after a finite number of instructions are executed.
- Input - the algorithm receives input.
- Output - the algorithm produces output.
- Generality - the algorithm applies to a set of inputs.
- Advantages of an algorithm
- Reduced complexity.
- Increased flexibility.
- Ease of understanding
- Disadvantages of an algorithm
- Multiple function calls are expensive.
- Inefficient when there is lots of branching from one state.
- Requires large amount of space as the each function state needs to be stored on system stack.
No comments:
Post a Comment