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

Time Complexity of A Program

Computer programming

Uploaded by

joriwalarakib10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Time Complexity of A Program

Computer programming

Uploaded by

joriwalarakib10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

CSE246: Algorithms

Introduction To Algorithms

1
Today’s Contents
• What is an Algorithm?

• Why are Algorithms Important?

• Basic Properties of Algorithms


• Different types of Algorithm
• Application of Algorithms in Real Life
• How to Write an Algorithm?

2
3
What is Algorithm?
• A step-by-step procedure or formula for solving a problem or
performing a task.
•Example: A recipe to bake a cake is an algorithm.
▪ It is a logical and mathematical approach to solve or crack a
problem using any possible method.

▪ Algorithms are generally created independent of underlying


languages, i.e. an algorithm can be implemented in more than
one programming language

4
Advantages for Algorithm

▪ The algorithms are very easy to understand and can be


written in simple language which can be understood by
anyone

▪ By using algorithms, we can easily understand the


sequence to be followed in processing.

▪ We can check and fix any kind of complexity easily.

5
Criteria of a Algorithm

6
Basic Properties of Algorithms:
• Correctness: Produces the right output for
all valid inputs.
• Efficiency: Makes optimal use of resources
(time and space).
• Finiteness: Terminates after a finite
number of steps.
• Clarity: Easily understandable and
modifiable

7
Different types of Algorithms

8
Different types of Algorithms

1. Searching Algorithms
2. Sorting Algorithms
3. Divide and conquer algorithms
4. Recursive algorithms
5. Backtracking algorithms
6. Brute force algorithms
7. Greedy Algorithms
8. Dynamic programming algorithms
9
Application of Algorithms

1. Searching Data
2. Sorting Data
3. Find out the Shortest Path
4. Best Possible solution

10
Some Real Life Examples

11
Some Real Life Examples
▪ Search Engine (Google, Microsoft Edge, Mozilla, Opera etc)
▪ Social networking (Facebook)
▪ Travelling route (Air Flight route, Google Map, Shipping route etc)
▪ Facial Recognition Algorithm
▪ Genetic Engineering

▪ Stock Market

▪ Artificial Intelligence

▪ Machine Learning

▪ Robotics

12
How to Write an Algorithm?
▪ There are no well-defined standards for writing algorithms.
▪ Rather, it is problem and resource dependent.

▪ Combination of human Language and Programming


Language, so that it is easily understandable even by
non-programmers.
▪ Algorithms are never written to support a particular
programming code.

13
finding the maximum
number in a list of
numbers:

14
basic sorting algorithm like
Bubble Sort:

15
Live Demo Using Interactive
Tools:
You can find videos that visually demonstrate sorting algorithms on
platforms like YouTube.
•Websites like VisuAlgo and SortingVisualizer also have interactive
visualizations for various algorithms.
•https://www.hackerearth.com/

16
Thank you!

17

You might also like