## Algorithm

- An algorithm is a step-by-step procedure to solve a problem in a finite number of steps.
- Branching and repetition are included in the steps of an algorithm.
- This branching and repetition depend on the problem for which Algorithm is developed.
- All the steps of Algorithm during the definition should be written in a human-understandable language which does not depend on any programming language.
- We can choose any programming language to implement the Algorithm.
- Pseudocode and flow chart are popular ways to represent an algorithm.

## An algorithm must satisfy the following criteria:

**1. Input:** An algorithm should have zero or more but should be a finite number of inputs. We can also say that it is essential for any algorithm before starting. Input should be given to it initially before the Algorithm begins.

**2. Output****:** An algorithm must give at least one required result from the given set of input values. These output values are known as the solution to a problem.

**3. Definiteness:** Each step must be clear, unambiguous, and precisely defined.

**4. Finiteness:** Finiteness means Algorithm should be terminated after a finite number of steps. Also, each step should be finished in a finite amount of time.

**5. Effectiveness:** Each step of the Algorithm must be feasible i.e., it should be practically possible to perform the action. Every Algorithm is generally expected to be effective.

## Characteristics of an algorithm:

**1). Input:** An algorithm must have either 0 or more inputs.**2). Output:** An algorithm should have 1 or more desired output.**3). Unambiguous:** Every Algorithm should be unambiguous and clear. It means that it’s every step, and input/output should be clear and must have only one meaning.**4). Feasibility:** Algorithm should be feasible with the available resource.**5). Finiteness:** Algorithm should be terminated after a finite number of steps.**6). Independent:** Algorithm should have a step-by-step direction of each level, which is independent of programming language.