Algorithms
Algorithms
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Agenda
In this session, we will discuss:
● What is an Algorithm?
● How does an algorithm work?
● Importance of Algorithms
● Real-Time Applications of Algorithms
● Types of Algorithms
● Characteristics or Factors of an Algorithm
● Designing an Algorithm
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
What is an Algorithm?
● An algorithm is a step-by-step procedure or a set of rules used to solve a specific problem or perform a
particular task.
Algorithm
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Algorithm
● Algorithms provide clear and unambiguous instructions for carrying out each step.
● Algorithms should terminate after a finite number of steps.
● It takes some input, performs a series of operations on it, and produces an output.
● It can be deterministic, where they will produce the same output for a given input every time they are
executed.
● An algorithm must produce the correct output for all valid inputs.
● They are often evaluated based on their efficiency in terms of time and space complexity.
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Importance of Algorithms
Graphics and Scientific Pattern
Image Research Recognition
Processing
Data
Processing Automation
and Analysis
Optimization
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
How does Algorithm Work?
Output
Input Processing
Optimization
Efficiency Implementation
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Real-Time Applications of Algorithms
GPS Navigation
Online Shopping
Search Engines
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Real-Time Applications of Algorithms
Voice Assistants
Credit Card
Fraud Detection Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Real-Time Applications of Algorithms
Weather Forecasting
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Real-Time Applications of Algorithms
Email Filtering
Optimizing Traffic
Signals
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Real-Time Applications of Algorithms
Healthcare Diagnostics
Online Advertising Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Types of Algorithms
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Types of Algorithms
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Factors of an Algorithm
Simplicity Extensibility
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Designing Algorithm - Example
● Steps involved in making of tea:
o Step 1: Place the fresh water in a kettle.
o Step 2: Boil the water to match your style of tea.
o Step 3: Put the tea bag in the cup.
o Step 4: Now pour the boiled water into the cup.
o Step 5: Add milk as per the required consistency.
o Step 6: Add sugar as per taste.
o Step 7: Stir the tea in the cup.
o Step 8: Drink the tea when it is hot.
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Designing Algorithm – Example
● Algorithm to add two numbers:
5 5
o Step 1: Start the problem.
A B
o Step 2: Get the values of A and B.
o Step 3: Find the sum of entered numbers A and B and store the result in C.
o Step 4: Display C. 10
o Step 5: Stop the problem. C =A + B
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Designing Algorithm – Example
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Designing Algorithm – Example
Input
● Algorithm to swap two numbers:
5 10
o Step 1: Start the problem.
a b
o Step 2: Input the values of a and b.
o Step 3: c = a Output
a=b 10 5
b=c a b
o Step 4: Print a,b .
o Step 5: Stop the problem.
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Designing Algorithm – Example
Input
● Algorithm to find largest of two numbers:
5 10
o Step 1: Start the problem.
a b
o Step 2: Input the values of a and b. Compare a and b.
o Step 3: If a>b then go to Step 5.
o Step 4: Print “b is largest” go to Step 6.
o Step 5: Print “a is largest”.
o Step 6: Stop.
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Summary
Here’s a brief recap:
● Algorithms are not exclusive to computer science; they are also used in various fields such as
mathematics, engineering, operations research, and everyday problem-solving.
● Importance of algorithms - By providing systematic approaches to problem-solving, algorithms have
become indispensable tools in various industries and aspects of daily life.
● They evolve and shape our lives, driving technological advancements and providing solutions to a wide
range of problems across multiple industries.
● Few examples of the different types of algorithms, and there are many more specialized algorithms for
specific tasks and domains.
● The factors of algorithms are very essential to decide the efficiency of an algorithm.
● The designing process of an algorithm should have finite states and output.
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.