Table of Contents
Introduction to Algorithms
An algorithm means “a process or set of rules to be followed in calculations or other problem-solving operations”. Therefore, an Algorithm refers to a set of rules/instructions that step-by-step define how a work is to be executed to get the expected results.
Characteristics of an Algorithm:
Clear and Unambiguous (past): Algorithm should be unambiguous. Each of its steps should be clear in all aspects and must lead to only one meaning.
Well-Defined Inputs: If an algorithm says to take inputs, it should be well-defined inputs.
Well-Defined Outputs: The algorithm must clearly define what output will be yielded and it should be well-defined as well.
Finite-ness: The algorithm must be finite, i.e. it should not end up in an infinite loop or similar.
Feasible (Shambhav): The algorithm must be simple, generic, and practical, such that it can be executed upon the available resources. It must not contain some future technology or anything.
Language Independent: The Algorithm designed must be language-independent, i.e. it must be just plain instructions that can be implemented in any language, and yet the output will be the same, as expected.
Example: Consider the example to add three numbers and print the sum.
Algorithm to add 3 numbers and print their sum:
- START
- Declare 4 integer variables a, b, c, d.
- Take the three numbers, to be added, as inputs in variables a, b, and c
- Add the 3 numbers and store the result in the variable
- Print the value of d
- END
a = 3, b = 4, c = 5
Add = 3 + 4 + 5
resulted = 12
Advantages of Algorithms:
- It is easy to understand.
- The algorithm is a step-wise representation of a solution to a given problem.
- In an Algorithm the problem is broken down into smaller pieces or steps hence, it is easier for the programmer to convert it into an actual program.
Disadvantages of Algorithms:
- Writing an algorithm takes a long time so it is time-consuming.
- Branching and Looping statements are difficult to show in Algorithms.
Add Your Heading Text Here
You May Like to Browers More


