You are on page 1of 3

Talha Shahab BCSE-17206

Discrete Mathematics
Chapter No. 3: Algorithms
 Algorithm
An algorithm is a finite sequence of precise instructions for performing a computation or for solving a
problem.
The word "algorithm" refers to a step-by-step method for performing some action. A computer program is,
similarly, a set of instructions that are executed step-by-step for performing some specific task. Algorithm,
however, is a more general term in that the term program refers to a particular programming language.

 Information About Algorithm


The following information is generally included when describing algorithms formally:
1. The name of the algorithm, together with a list of input and output variables.
2. A brief description of how the algorithm works.
3. The input variable names, labeled by data type.
4. The statements that make the body of the algorithm, with explanatory comments.
5. The output variable names, labeled by data type.
6. An end statement.

 PROPERTIES OF ALGORITHMS
There are several properties that algorithms generally share. They are useful to keep in mind when algorithms
are described. These properties are:
Input. An algorithm has input values from a specified set.
Output. From each set of input values an algorithm produces output values from a specified set. The output
values are the solution to the problem.
Definiteness. The steps of an algorithm must be defined precisely.
Correctness. An algorithm should produce the correct output values for each set of input values.
Finiteness. An algorithm should produce the desired output after a finite (but perhaps large) number of steps
for any input in the set.
Effectiveness. It must be possible to perform each step of an algorithm exactly and in a finite amount of time.
Generality. The procedure should be applicable for all problems of the desired form, not just for a particular
set of input values.

 ALGORITHM 1 Finding the Maximum Element in a Finite Sequence

1|Page
 ALGORITHM 2 The Linear Search Algorithm

 ALGORITHM 3 The Binary Search Algorithm.

 ALGORITHM 4 The Bubble Sort

2|Page
 ALGORITHM 5 The Insertion Sort

3|Page

You might also like