Page 41 - iPro_trackGPT_V5_Class8
P. 41
CHARACTERISTICS OF A GOOD ALGORITHM
A good algorithm has these main features:
Precision: Each step is clearly described.
Uniqueness: Each step's result should be specific and depend only on the previous step.
Finiteness: The algorithm must finish after a set number of steps.
Definiteness: Each step of the algorithm should be precisely defined and unambiguous.
Well-Defined Input: The input to an algorithm must be clearly specified and precisely
defined.
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.
Correctness: It must solve the problem accurately and produce the correct output for all valid
inputs.
USES OF AN ALGORITHM
Algorithms are commonly used for:
Data Processing: Algorithms are indeed used for handling and organising data, including
tasks like sorting, filtering, and aggregating.
Logical and Mathematical Operations: Algorithms perform various calculations and logical
operations, such as arithmetic, algebraic computations, and logical decisions.
Data Manipulation: Algorithms are used to alter or manage data, including operations like
updating, merging, and transforming data formats.
Searching for Data: Algorithms enable efficient searching and retrieval of specific information
from datasets, such as using search algorithms to find items in a database or files in a directory.
WRITING AN ALGORITHM
Writing an algorithm is an essential step in problem-solving and programming because it helps
in planning and visualising the solution before it is implemented in code. Writing an algorithm
involves creative thinking to find the best way to arrange steps to get the desired result. For
example, if you need to find the fastest route to school, you would think about different paths,
consider traffic, and choose the best route based on your needs.
Let us understand the concept of the writing an algorithm with help of 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 the two numbers A and B and store the result in Product.
Step 4: Print the Product.
Step 5: Add the two numbers A and B and store the result in Sum.
Step 6: Print the Sum.
Algorithms and Flowcharts 39

