## Algorithms:

#### Agenda:

**What is an Algorithm?****What is Problem Solving?****What are the characteristics of the algorithm?****Example of Algorithm.****Algorithm design tools:****Pseudo-code and**

### Introduction to Algorithm:

-In Computer Science, Algorithm is a sequence of well-defined rules to be followed in problem-solving operations. An algorithm is a step by step structure of a program written in simple English language to solve problems.

-Let see a real-time example of Algorithms, If you want to draw a sketch of a horse first you need to know the what are the steps to draw a sketch. so the first is an outlining, shading, then detailing and the last one is finishing Now we can consider these steps as an algorithm because it tells us that How to draw a Sketch of Horse or anything likewise

-In Mathematics or in computer Science algorithm is a step by step rules or instruction to solve the problems also the algorithm tells how a work is to be done or executed.

### Characteristics of the algorithm:

-Unambiguous: Algorithms are always Unambiguous, Unambiguous means is clear and well-defined and algorithm should be unambiguous and clear

-Well-Defined Input and Output: Input must be clear cut in the algorithm as well as the output is also clear in terms of what will be.

-Finite: Algorithms should finite-ness

-Feasible: must be practical and possible to do easily that it can be executed using available resources.

-Effectiveness: Instruction must be basic enough.

#### Example of Algorithm:

(Write an Algorithm to add two integer numbers)

Step 1: Start,

Step 2: Declare n1,n2 and add,

Step 4: Read the values of variables n1 and n2,

Step 5: Add n1 and n2 to and assign to add,

Step 6: Display add (Result),

Step 7: Stop.

### Algorithm design tools:

**1) Pseudo-code:**

In Computer Science Pseudo-Code is a combination of normal instruction and programming logic. simply it is an implementation of Algorithms. Pseudocode is an informal way of programming description that does not require any strict programming language syntax or underlying technology considerations it is just outlining.

**Example**:

(Write Pseudo-code for the addition of two numbers)

- BEGIN
- Integer numbers n1,n2, and sum
- initialize n1=1 and n2=2
- sum =n1+n2
- Output sum
- END.

**2) FlowChart:**

Flowchart is a graphical representation of algorithms or diagrammatical representation of an algorithm, workflow, or process. The flowcharts show different step by step boxes. Flowcharts are used in analyzing, designing, documenting, or managing a process or program.

**Example:**

(Flowchart of the addition of two numbers)

## Comments

## Post a Comment

If you have any query, please let us know