Page 117 - TP_Prime_v2.2_Class_6
P. 117
Algorithms are the building blocks of computer programs. They are important to
programming as recipes are for cooking. An algorithm is always written in very simple words
and precise language so that the steps can be understood easily by everyone.
In computer terms, 'Algorithm is the sequence of steps or computer operations which
collectively solve a given problem'.
Characteristics of a Good Algorithm
The main characteristics of a good algorithm are: PROGRAMMING LANGUAGES
• Precision: Each step is precisely defined. PROBLEM SOLVING AND
• Uniqueness: The result of each step can be uniquely identified and only depends on the
result of the preceding step.
• Finiteness: It stops after a finite number of instructions are executed.
• Well-Defined Input: The input to an algorithm must be clearly specified and precisely
defined. 115
• Well-Defined Output: The output produced by the algorithm must also be clearly
specified and precisely defined.
• Effectiveness: The algorithm should be efficient in terms of time and space.
Uses of an Algorithm
Algorithm is commonly used for:
• Performing data processing • Performing computer and mathematical operations
• Manipulating data • Searching for a particular data
Writing an Algorithm
The construction of an algorithm is a process that requires creative thinking and finding
the best possible combination of steps to get the result. For example,
A. Algorithm to find product, sum, and difference of two numbers.
Step 1: Start.
Step 2: Read two numbers and store them in A and B.
Step 3: Multiply two numbers A and B and store the result in Product.
Step 4: Print the product.
Step 5: Add two numbers A and B and store the result in Sum.
Step 6: Print the sum.
Step 7: Subtract the number B from the number A and store the result in Difference.
Step 8: Print the difference.
Step 9: Stop.

