You are on page 1of 7

Definition of Algorithm

The word Algorithm means” A set of finite rules or instructions to be followed in


calculations or other problem-solving operations”

Why we use algorithms:


 Efficiency: Algorithms can perform tasks quickly and accurately, making them an
essential tool for tasks that require a lot of calculations or data processing.
 Consistency: Algorithms are repeatable and produce consistent results every
time they are executed. This is important when dealing with large amounts of
data or complex processes.
 Scalability: Algorithms can be scaled up to handle large datasets or complex
problems, which makes them useful for applications that require processing large
volumes of data.
 Automation: Algorithms can automate repetitive tasks, reducing the need for
human intervention and freeing up time for other tasks.
 Standardization: Algorithms can be standardized and shared among different
teams or organizations, making it easier for people to collaborate and share
knowledge.
Overall, algorithms are an essential tool for solving problems in a variety of fields,
including computer science, engineering, data analysis, finance, and many others

Algorithm Development Steps

The process of algorithm development generally involves many steps. The general steps
involved in algorithm development are as follows:
1. Problem Definition
2. Problem Analysis
3. Algorithm Design
4. Flowchart
5. Implementation
6. Testing
7. Documentation
Types of Algorithms:

 Sorting algorithms: Bubble Sort, insertion sort, and many more. These
algorithms are used to sort the data in a particular format.

 Searching algorithms: Linear search, binary search, etc. These algorithms are
used in finding a value or record that the user demands.

 Graph Algorithms: It is used to find solutions to problems like finding the


shortest path between cities, and real-life problems like traveling salesman
problems.


Characteristics of an Algorithm?
 As one would not follow any written instructions to cook the recipe, but only the
standard one. Similarly, not all written instructions for programming are an
algorithm. For some instructions to be an algorithm, it must have the following
characteristics:

 Clear and Unambiguous: The 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. It may or may not take input.

 Well-Defined Outputs: The algorithm must clearly define what output will be
yielded and it should be well-defined as well. It should produce at least 1 output.

 Finite-ness: The algorithm must be finite, i.e. it should terminate after a finite
time.

 Feasible: The algorithm must be simple, generic, and practical, such that it can
be executed with 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.

 Input: An algorithm has zero or more inputs. Each that contains a fundamental
operator must accept zero or more inputs.

 Output: An algorithm produces at least one output. Every instruction that


contains a fundamental operator must accept zero or more inputs.

 Definiteness: All instructions in an algorithm must be unambiguous, precise, and


easy to interpret. By referring to any of the instructions in an algorithm one can
clearly understand what is to be done. Every fundamental operator in instruction
must be defined without any ambiguity.

 Finiteness: An algorithm must terminate after a finite number of steps in all test
cases. Every instruction which contains a fundamental operator must be
terminated within a finite amount of time. Infinite loops or recursive functions
without base conditions do not possess finiteness.

 Effectiveness: An algorithm must be developed by using very basic, simple, and


feasible operations so that one can trace it out by using just paper and pencil.

Advantages of Algorithms
1. Easy to understand: Since it is a stepwise representation of a solution to a
given problem, it is easy to understand.

2. Language Independent: It is not dependent on any programming language,


so it can easily be understood by anyone.

3. Debug / Error Finding: Every step is independent / in a flow so it will be easy


to spot and fix the error.

4. Sub-Problems: It is written in a flow so now the programmer can divide the


tasks which make them easier to code.

Disadvantages of Algorithms
 Creating efficient algorithms is time-consuming and requires good logical skills.

 Nasty to show branching and looping in algorithms.

Real-life examples that define the use of algorithms:


 Consider a clock. We know the clock is ticking but how does the manufacturer set
those nuts and bolts so that it keeps on moving every 60 seconds, the min hand
should move and every 60 mins, the hour hand should move? So to solve this
problem, there must be an algorithm behind it.

 Seen someone cooking your favorite food for you? Is the recipe necessary for
it? Yes, it is necessary as a recipe is a sequential procedure that turns a raw
potato into a chilly potato. This is what an algorithm is: following a procedure to
get the desired output. Is the sequence necessary to be followed? Yes, the
sequence is the most important thing that has to be followed to get what we want.

Algorithm Complexity:
An algorithm is analyzed using Time Complexity and Space Complexity. Writing an
efficient algorithm help to consume the minimum amount of time for processing the
logic. For algorithm A, it is judged on the basis of two parameters for an input of size
n any number of elements. :
 Time Complexity: Time taken by the algorithm to solve the problem. It is
measured by calculating the iteration of loops, number of comparisons etc.
 Space Complexity: Space taken by the algorithm to solve the problem. It
includes space used by necessary input variables and any extra space
(excluding the space taken by inputs) that is used by the algorithm. For
example, if we use a hash table (a kind of data structure), we need an array to
store values so this is an extra space occupied, hence will count towards the
space complexity of the algorithm. This extra space is known as Auxiliary
Space

Flow Chart Definition:

Flowchart is a graphical representation of an algorithm. Programmers often


use it as a program-planning tool to solve a problem. It makes use of symbols
which are connected among them to indicate the flow of information and
processing. Flow chart is a convenient technique to represent the flow of
control in a program.

 Symbols used in flow chart:


Difference between algorithm and flow chart:
S.
No Algorithm Flowchart

An algorithm is a step-by-step A flowchart is a diagram created with


1. procedure to solve a problem. different shapes to show the flow of data.

The algorithm is complex to


2. understand. A flowchart is easy to understand.

3. In the algorithm, plain text is used. In the flowchart, symbols/shapes are used.

4. The algorithm is easy to debug. A flowchart is hard to debug.

The algorithm is difficult to


5. construct. A flowchart is simple to construct.

The algorithm does not follow any


6. rules. The flowchart follows rules to be constructed.

The algorithm is the pseudo-code A flowchart is just a graphical representation


7. for the program. of that logic.

Pseudo code:
Pseudo code is an informal way of programming description that does not require any
strict programming language syntax or underlying technology considerations. It is used
for creating an outline or a rough draft of a program.

You might also like