The algorithm is a finite sequence of instructions, each of which has a clear meaning and can be performed with a finite amount of effort in a finite length of time. No matter what the input values may be, an algorithm terminates after executing a finite number of instructions.

We represent an algorithm using a pseudo-language that is a combination of the constructs of a programming language together with informal English statements. The ordered set of instructions required to solve a problem is known as an algorithm. The characteristics of a good algorithm are:

- Precision â€“ the steps are precisely stated (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.

### Example:

Write an algorithm to find out number is odd or even?

step 1: start

In step 2: input number

step 3: rem=number mod 2

step 4: if rem=0 then

print “number even”

else

print “number odd”

endif

step 5: stop

### FLOWCHART:

A flowchart is a type of diagram that represents a workflow or process. A flowchart is a diagrammatic representation of an algorithm, a step-by-step approach to solving a task.

- Analyzing the problem statement means making the objective of the program clear in our minds like what the input is and what is the required output.

- Sometimes the problems are of complex nature, to make them easier to understand, we can break down the problem into smaller sub-parts.

- In order to save our time in debugging our code, we should first-of-all write down the solution on a paper with basic steps that would help us get a clear intuition of what we are going to do with the problem statement.

- In order to make the solution error-free, the next step is to verify the solution by checking it with a bunch of test cases.

- Now, we clearly know what we are going to do in the code. In this step, we will start coding our solution on the compiler.

**Flowcharts**

**Uses of Flowcharts**

- Used in the documentation.
- Used to communicate oneâ€™s solution with others, basically used for group projects.
- To check out at any step what we are going to do and get a clear explanation of theflow of statements.

###### Flowchart components

**Terminators**

**input/output**

- Process

- Decision

- Arrows

- Connector

Example 1:

Suppose we have to make a flowchart for adding 2 numbers a and b.

Solution:

#### Summary

- Flowcharts are the building block of any program written in any language.
- Different shapes used to have different meanings.
- Every problem can be represented in the form of a flow chart.
- Sometimes, it becomes a bulky process to represent any program using a flowchart.
- In those cases, try to find out the optimal solution to the given problem.

## One comment on “ALGORITHM AND FLOWCHART :”