0% found this document useful (0 votes)
7 views

Algorithms

The document discusses algorithms including what they are, how they work, their importance and applications. It covers different types of algorithms like sorting, searching, graph algorithms and more. It also discusses factors to consider when designing algorithms.

Uploaded by

manishdahiya731
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Algorithms

The document discusses algorithms including what they are, how they work, their importance and applications. It covers different types of algorithms like sorting, searching, graph algorithms and more. It also discusses factors to consider when designing algorithms.

Uploaded by

manishdahiya731
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Introduction to 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.

Set of rules to obtain


Input Output
the expected output

Algorithm

Muhammad ibn Mūsā al’Khwārizmī

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

Web Search and


Cryptography
Information
and Security
Retrieval
Importance of
Algorithms
Machine Efficient
Learning Problem
Solving

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

Algorithms help to calculate the fastest routes,


considering real-time traffic data, road conditions,
and alternative paths.

GPS Navigation

Use Algorithms to curate your feed, showing you


posts, advertisements, and content tailored to your
interests and previous interactions.

Social Media Feeds


Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Real-Time Applications of Algorithms

Use algorithms to recommend products or


movies based on your browsing history,
purchase behavior, and preferences.

Online Shopping

Use algorithms to return relevant search


results from vast amounts of indexed web
pages.

Search Engines
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Real-Time Applications of Algorithms

Use algorithms to understand and respond to


your voice commands accurately.

Voice Assistants

Use algorithms to detect unusual patterns and


flag potentially fraudulent transactions on your
credit card.

Credit Card
Fraud Detection Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Real-Time Applications of Algorithms

Use algorithms to match drivers with riders,


optimize routes, and calculate fares based on
factors like distance, demand, and surge pricing.

Ride - Sharing Services

Use algorithms to analyze data from weather


stations, satellites, and other sources to forecast
weather conditions accurately.

Weather Forecasting
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Real-Time Applications of Algorithms

Use algorithms to classify incoming emails


as spam or legitimate messages, helping to
keep your inbox organized.

Email Filtering

Use algorithms to optimize traffic signal


timings, reducing congestion and improving
traffic flow.

Optimizing Traffic
Signals
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Real-Time Applications of Algorithms

Use algorithms in various diagnostic tools


and imaging techniques like MRI, CT
scans, and X-rays.

Healthcare Diagnostics

Algorithms are used to target relevant ads to


specific audiences based on demographics,
interests, and online behavior.

Online Advertising Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Types of Algorithms

Sorting Algorithms: Searching Algorithms:


Graph Algorithms:
Sorting algorithms Searching algorithms
These algorithms
arrange elements in a find the location of a
operate on graphs.
specific order. particular item.

Greedy Algorithms: Backtracking


Greedy algorithms make Algorithms:
locally optimal choices Backtracking is a
at each step, hoping to technique used to find
find a global optimum. all possible solutions.

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Types of Algorithms

Randomized String Matching


Dynamic Programming
Algorithms: Algorithms:
Algorithms:
Use randomness to Used to find occurrences
Used to break down
achieve the desired of a particular pattern
complex problems
outcome. within a larger string.

Divide and Conquer


Cryptography
Algorithms:
Algorithms:
Breaking a problem and
Used to secure data and
then combining their
communication.
solutions.

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Factors of an Algorithm

Modularity Correctness Maintainability

Functionality Finiteness User-Friendly

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

● Algorithm to multiply 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 product of entered numbers A and B and store the result in C.
25
o Step 4: Display C.
C =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 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.

You might also like