SlideShare a Scribd company logo
Spotle.ai Study Material
Spotle.ai/Learn
Introduction
To
Algorithms
Spotle.ai Study Material
Spotle.ai/Learn
Gift him a shampoo
pack with instructions:
- Lather
- Rinse
- Repeat
How Do You Keep A Software Engineer
Shampooing Forever?
Img Src: Wikipedia
2
Spotle.ai Study Material
Spotle.ai/Learn
Have you figured out
which direction to go
yet?
Ambiguous Instructions Stump Everyone
Not Just Software Engineers
Img Src: pinterest
3
Spotle.ai Study Material
Spotle.ai/Learn
Machines Need Clear Instructions Too
4
A computer executes a
program which is
nothing but a sequence
of codified instructions.
Spotle.ai Study Material
Spotle.ai/Learn
What Is An Algorithm?
Img Src: pandora
5
The sequence of
steps to solve a
specific problem or
attain a specific
goal is called an
algorithm.
Spotle.ai Study Material
Spotle.ai/Learn
Machines need clear
instructions to solve a
problem optimally. You need
to feed your machine the
right algorithm to get the
correct result within
minimum resources (time,
CPU units, memory).
Why Are Algorithms Important?
Img Src: pchelp
6
Spotle.ai Study Material
Spotle.ai/Learn
The Software Development Life Cycle
7
Problem Definition
Requirement Analysis
Define Algorithm
Develop Program
Testing and Deployment
Spotle.ai Study Material
Spotle.ai/Learn
As a software engineer, your
key responsibility will be to
understand business
problems and find the best
path to solve them. In short
this is what your daily task
will look like:
PROBLEM -----------> SOLUTION
Algorithm
What Software Engineers Do
8
Spotle.ai Study Material
Spotle.ai/Learn
Input and
Output
Finite
Correct Definite
Effective
Characteristics Of An Algorithm
9
Spotle.ai Study Material
Spotle.ai/Learn
Efficiency Of An Algorithm
10
Efficiency Of The Algorithm
Space
Complexity
Time
Complexity
Spotle.ai Study Material
Spotle.ai/Learn
Time complexity of
an algorithm denotes the amount
of time taken by an algorithm to
run, expressed as a function of
the length of the input. Time
complexity actually measures the
number of steps the algorithm
executes rather than the actual
time taken which depends also on
factors like processor speed,
network load etc.
Time Complexity
11
Spotle.ai Study Material
Spotle.ai/Learn
Space Complexity of
an algorithm is
total space taken by
the algorithm as a
function of the input size. 
Space Complexity
12
Spotle.ai Study Material
Spotle.ai/Learn
The Big O
13
My
algorithms
are O(1).
Big O describes the
performance or complexity of
an algorithm. It denotes the
worst-case scenario, and can
be used to describe the
execution time required or the
space used (e.g. in memory or
on disk) by an algorithm. The
Big O denotes the order of the
algorithm as a function of its
input size: eg O(1), O(n),
O(logn).
Spotle.ai Study Material
Spotle.ai/Learn
O(1) algorithms always take a
constant amount of time
irrespective of the size of the
input.
For example, the algorithm to
check if the first number in a
list is 5 will always take
constant time irrespective of
the size of the list.
O(1) Algorithms
14
1
3
4
5
8
3
2
22
223
O(1) O(1)
Is this
5?
Is this
5?
Spotle.ai Study Material
Spotle.ai/Learn


Say you have a jumbled up list of 8
numbers. You have to find if number 5
is in the list. What will you do?
Pick each number
If number = 5, terminate.
If number is not equal to 5, keep
number aside. Search the rest of the
numbers. In the worst case you have
to do this n = 8 times. The algorithm
has complexity = O(n).
O(n) Algorithms
15
3
100
15
2
1
8
20
5
Is this 5?
Is this 5?
Is this 5?
Is this 5?
Is this 5?
Is this 5?
Is this 5?
Is this 5?
Spotle.ai Study Material
Spotle.ai/Learn
Say the list in the last
example is now sorted. How
much time will you take to
find 5 in the list?
O(logn) Algorithms
16
1
2
5
7
15
20
22
100
Spotle.ai Study Material
Spotle.ai/Learn
Pass 1: Divide the list into 2.
Compare 5 to the largest
(bottom-most number) in
upper partition. Since 5 < 7,
5 will be in the upper
partition. Discard lower
partition.
O(logn) Algorithms
17
1
2
5
7
15
20
22
100
Spotle.ai Study Material
Spotle.ai/Learn
Pass 2: Divide the list from
pass1 into 2 halves.
Compare 5 with the largest
number in the upper
partition. Since 5 > 2, 5 must
be in the lower partition.
Discard the upper partition
O(logn) Algorithms
18
1
2
5
7
Spotle.ai Study Material
Spotle.ai/Learn
Pass 3: Divide the list from
pass 2 into 2 halves.
Compare 5 with the largest
number (the lower-most
number) in the upper
partition. You have found
your 5!
O(logn) Algorithms
19
5
7
Spotle.ai Study Material
Spotle.ai/Learn
In this algorithm you are
halving the input set till you
have partitions of 1. How
many times do you have to
repeat the operation of
halving the set?
Let k be the number of times
the set is halved
Then n/2k = 1 or k = log2n
O(logn) Algorithms
20
5
7
1
2
5
7
15
20
22
100
1
2
5
7
Spotle.ai Study Material
Spotle.ai/Learn
The Problem: Find the smallest
number in the list
The easiest solution is to take
each number in the list and
compare to all other numbers
in the list to see if it is the
smallest number. For a list of
size 3, in the worst case this
will be done 3 x 3 times or 9
times. The algorithm has
complexity O(n2)
O(n2) Algorithms
21
20
7
5
20
7
5
O(n2) Comparisons
Spotle.ai Study Material
Spotle.ai/Learn
Is there a more efficient way of
finding the smallest number in a
list?
Lets designate the first number in
the list, in this case 20 as the
smallest number. Compare each
number in the list with the
smallest number. If the number is
smaller than the smallest number,
set smallest number = number.
You are repeating this n=3 times.
The complexity is O(n).
Reducing Algorithmic Complexity
22
20
5
7
20
20
5
7
5
20
5
7
5
1st pass.
20 is taken
to be smallest
2nd pass.
5 is taken
to be smallest;
because 5 is
smaller than 20.
3rd pass.
5 stands as the
smallest;
because 5 is
smaller than 7.
Spotle.ai Study Material
Spotle.ai/Learn
While designing
complex systems, large
systems are broken
down into modules.
This process is called
modularization.
Modular Approach To System Design
Img Src: Wikipedia
23
Design Engine
Design Body
Design Storage
Spotle.ai Study Material
Spotle.ai/Learn
Understand
Problem
Modularize
Problem
Evaluate
Algorithms
Choose Most
Optimal
Algorithm
Convert To
Code
Problem Solution Approach
24

More Related Content

What's hot

Learn from LL(1) to PEG parser the hard way
Learn from LL(1) to PEG parser the hard wayLearn from LL(1) to PEG parser the hard way
Learn from LL(1) to PEG parser the hard way
Kir Chou
 
Python-01| Fundamentals
Python-01| FundamentalsPython-01| Fundamentals
Python-01| Fundamentals
Mohd Sajjad
 
Quiz On Strings
Quiz On StringsQuiz On Strings
Quiz On Strings
Bhavya Singhal
 
Matlab python-
Matlab python-Matlab python-
Matlab python-
Dr. Volkan OBAN
 
Python If Else | If Else Statement In Python | Edureka
Python If Else | If Else Statement In Python | EdurekaPython If Else | If Else Statement In Python | Edureka
Python If Else | If Else Statement In Python | Edureka
Edureka!
 
Erlang
ErlangErlang
Erlang
Balaji G
 
Introduction To Programming with Python-3
Introduction To Programming with Python-3Introduction To Programming with Python-3
Introduction To Programming with Python-3
Syed Farjad Zia Zaidi
 
Python for Scientific Computing
Python for Scientific ComputingPython for Scientific Computing
Python for Scientific Computing
Albert DeFusco
 
Cs419 lec11 bottom-up parsing
Cs419 lec11   bottom-up parsingCs419 lec11   bottom-up parsing
Cs419 lec11 bottom-up parsing
Arab Open University and Cairo University
 
Python programming msc(cs)
Python programming msc(cs)Python programming msc(cs)
Python programming msc(cs)
KALAISELVI P
 
Python programming
Python programmingPython programming
Python programming
saroja20
 
Python programming
Python programmingPython programming
Python programming
saroja20
 
Python revision tour II
Python revision tour IIPython revision tour II
Python revision tour II
Mr. Vikram Singh Slathia
 
Lesson 03 python statement, indentation and comments
Lesson 03   python statement, indentation and commentsLesson 03   python statement, indentation and comments
Lesson 03 python statement, indentation and comments
Nilimesh Halder
 
Top down parsing
Top down parsingTop down parsing
Top down parsing
Prankit Mishra
 
Python Data Types
Python Data TypesPython Data Types
Python Data Types
athithanvijay
 
Python week 7 8 2019-2020 for grade 10
Python week 7 8 2019-2020 for grade 10Python week 7 8 2019-2020 for grade 10
Python week 7 8 2019-2020 for grade 10
Osama Ghandour Geris
 
Effective Algorithm for n Fibonacci Number By: Professor Lili Saghafi
Effective Algorithm for n Fibonacci Number By: Professor Lili SaghafiEffective Algorithm for n Fibonacci Number By: Professor Lili Saghafi
Effective Algorithm for n Fibonacci Number By: Professor Lili Saghafi
Professor Lili Saghafi
 
Parsing
ParsingParsing
Left factor put
Left factor putLeft factor put
Left factor put
siet_pradeep18
 

What's hot (20)

Learn from LL(1) to PEG parser the hard way
Learn from LL(1) to PEG parser the hard wayLearn from LL(1) to PEG parser the hard way
Learn from LL(1) to PEG parser the hard way
 
Python-01| Fundamentals
Python-01| FundamentalsPython-01| Fundamentals
Python-01| Fundamentals
 
Quiz On Strings
Quiz On StringsQuiz On Strings
Quiz On Strings
 
Matlab python-
Matlab python-Matlab python-
Matlab python-
 
Python If Else | If Else Statement In Python | Edureka
Python If Else | If Else Statement In Python | EdurekaPython If Else | If Else Statement In Python | Edureka
Python If Else | If Else Statement In Python | Edureka
 
Erlang
ErlangErlang
Erlang
 
Introduction To Programming with Python-3
Introduction To Programming with Python-3Introduction To Programming with Python-3
Introduction To Programming with Python-3
 
Python for Scientific Computing
Python for Scientific ComputingPython for Scientific Computing
Python for Scientific Computing
 
Cs419 lec11 bottom-up parsing
Cs419 lec11   bottom-up parsingCs419 lec11   bottom-up parsing
Cs419 lec11 bottom-up parsing
 
Python programming msc(cs)
Python programming msc(cs)Python programming msc(cs)
Python programming msc(cs)
 
Python programming
Python programmingPython programming
Python programming
 
Python programming
Python programmingPython programming
Python programming
 
Python revision tour II
Python revision tour IIPython revision tour II
Python revision tour II
 
Lesson 03 python statement, indentation and comments
Lesson 03   python statement, indentation and commentsLesson 03   python statement, indentation and comments
Lesson 03 python statement, indentation and comments
 
Top down parsing
Top down parsingTop down parsing
Top down parsing
 
Python Data Types
Python Data TypesPython Data Types
Python Data Types
 
Python week 7 8 2019-2020 for grade 10
Python week 7 8 2019-2020 for grade 10Python week 7 8 2019-2020 for grade 10
Python week 7 8 2019-2020 for grade 10
 
Effective Algorithm for n Fibonacci Number By: Professor Lili Saghafi
Effective Algorithm for n Fibonacci Number By: Professor Lili SaghafiEffective Algorithm for n Fibonacci Number By: Professor Lili Saghafi
Effective Algorithm for n Fibonacci Number By: Professor Lili Saghafi
 
Parsing
ParsingParsing
Parsing
 
Left factor put
Left factor putLeft factor put
Left factor put
 

Similar to Introduction To Algorithms

Algorithm Assignment Help
Algorithm Assignment HelpAlgorithm Assignment Help
Algorithm Assignment Help
Programming Homework Help
 
Small Basic Calculator Apps lesson
Small Basic Calculator Apps lessonSmall Basic Calculator Apps lesson
Small Basic Calculator Apps lesson
Edujetage
 
Lecture-1-Algorithms.pptx
Lecture-1-Algorithms.pptxLecture-1-Algorithms.pptx
Lecture-1-Algorithms.pptx
xalahama3
 
Introduction to Algorithms
Introduction to AlgorithmsIntroduction to Algorithms
Introduction to Algorithms
Mohamed Essam
 
daa unit 1.pptx
daa unit 1.pptxdaa unit 1.pptx
daa unit 1.pptx
LakshayYadav46
 
Unit 1-problem solving with algorithm
Unit 1-problem solving with algorithmUnit 1-problem solving with algorithm
Unit 1-problem solving with algorithm
rajkumar1631010038
 
Algorithms
AlgorithmsAlgorithms
Algorithms
cachs_computing
 
Mastering Python lesson 3a
Mastering Python lesson 3aMastering Python lesson 3a
Mastering Python lesson 3a
Ruth Marvin
 
The secret of Functional Programming revealed!
The secret of Functional Programming revealed!The secret of Functional Programming revealed!
The secret of Functional Programming revealed!
Torbjørn Marø
 
ForLoops.pptx
ForLoops.pptxForLoops.pptx
ForLoops.pptx
RabiyaZhexembayeva
 
A Gentle Introduction to Coding ... with Python
A Gentle Introduction to Coding ... with PythonA Gentle Introduction to Coding ... with Python
A Gentle Introduction to Coding ... with Python
Tariq Rashid
 
CMPS 5P Assignment 3 Spring 19Instructions1. The aim o.docx
CMPS 5P Assignment 3 Spring 19Instructions1. The aim o.docxCMPS 5P Assignment 3 Spring 19Instructions1. The aim o.docx
CMPS 5P Assignment 3 Spring 19Instructions1. The aim o.docx
mary772
 
9 big o-notation
9 big o-notation9 big o-notation
9 big o-notation
irdginfo
 
Python - Lecture 10
Python - Lecture 10Python - Lecture 10
Python - Lecture 10
Ravi Kiran Khareedi
 
Merge sort analysis and its real time applications
Merge sort analysis and its real time applicationsMerge sort analysis and its real time applications
Merge sort analysis and its real time applications
yazad dumasia
 
Questions4
Questions4Questions4
Questions4
hccit
 
Data Structures and Algorithms - Lec 02.pdf
Data Structures and Algorithms - Lec 02.pdfData Structures and Algorithms - Lec 02.pdf
Data Structures and Algorithms - Lec 02.pdf
RameshaFernando2
 
Design & Analysis Of Algorithm
Design & Analysis Of AlgorithmDesign & Analysis Of Algorithm
Design & Analysis Of Algorithm
Computer Hardware & Trouble shooting
 
Learn python
Learn pythonLearn python
Learn python
mocninja
 
Python Interview Questions And Answers
Python Interview Questions And AnswersPython Interview Questions And Answers
Python Interview Questions And Answers
H2Kinfosys
 

Similar to Introduction To Algorithms (20)

Algorithm Assignment Help
Algorithm Assignment HelpAlgorithm Assignment Help
Algorithm Assignment Help
 
Small Basic Calculator Apps lesson
Small Basic Calculator Apps lessonSmall Basic Calculator Apps lesson
Small Basic Calculator Apps lesson
 
Lecture-1-Algorithms.pptx
Lecture-1-Algorithms.pptxLecture-1-Algorithms.pptx
Lecture-1-Algorithms.pptx
 
Introduction to Algorithms
Introduction to AlgorithmsIntroduction to Algorithms
Introduction to Algorithms
 
daa unit 1.pptx
daa unit 1.pptxdaa unit 1.pptx
daa unit 1.pptx
 
Unit 1-problem solving with algorithm
Unit 1-problem solving with algorithmUnit 1-problem solving with algorithm
Unit 1-problem solving with algorithm
 
Algorithms
AlgorithmsAlgorithms
Algorithms
 
Mastering Python lesson 3a
Mastering Python lesson 3aMastering Python lesson 3a
Mastering Python lesson 3a
 
The secret of Functional Programming revealed!
The secret of Functional Programming revealed!The secret of Functional Programming revealed!
The secret of Functional Programming revealed!
 
ForLoops.pptx
ForLoops.pptxForLoops.pptx
ForLoops.pptx
 
A Gentle Introduction to Coding ... with Python
A Gentle Introduction to Coding ... with PythonA Gentle Introduction to Coding ... with Python
A Gentle Introduction to Coding ... with Python
 
CMPS 5P Assignment 3 Spring 19Instructions1. The aim o.docx
CMPS 5P Assignment 3 Spring 19Instructions1. The aim o.docxCMPS 5P Assignment 3 Spring 19Instructions1. The aim o.docx
CMPS 5P Assignment 3 Spring 19Instructions1. The aim o.docx
 
9 big o-notation
9 big o-notation9 big o-notation
9 big o-notation
 
Python - Lecture 10
Python - Lecture 10Python - Lecture 10
Python - Lecture 10
 
Merge sort analysis and its real time applications
Merge sort analysis and its real time applicationsMerge sort analysis and its real time applications
Merge sort analysis and its real time applications
 
Questions4
Questions4Questions4
Questions4
 
Data Structures and Algorithms - Lec 02.pdf
Data Structures and Algorithms - Lec 02.pdfData Structures and Algorithms - Lec 02.pdf
Data Structures and Algorithms - Lec 02.pdf
 
Design & Analysis Of Algorithm
Design & Analysis Of AlgorithmDesign & Analysis Of Algorithm
Design & Analysis Of Algorithm
 
Learn python
Learn pythonLearn python
Learn python
 
Python Interview Questions And Answers
Python Interview Questions And AnswersPython Interview Questions And Answers
Python Interview Questions And Answers
 

More from Spotle.ai

Spotle AI-thon - AI For Good Business Plan Showcase - Team IIM Indore - AI Ro...
Spotle AI-thon - AI For Good Business Plan Showcase - Team IIM Indore - AI Ro...Spotle AI-thon - AI For Good Business Plan Showcase - Team IIM Indore - AI Ro...
Spotle AI-thon - AI For Good Business Plan Showcase - Team IIM Indore - AI Ro...
Spotle.ai
 
Spotle AI-thon - AI For Good Business Plan Showcase - Cummins College
Spotle AI-thon - AI For Good Business Plan Showcase - Cummins CollegeSpotle AI-thon - AI For Good Business Plan Showcase - Cummins College
Spotle AI-thon - AI For Good Business Plan Showcase - Cummins College
Spotle.ai
 
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Elit...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Elit...Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Elit...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Elit...
Spotle.ai
 
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India- Ankur chat...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India- Ankur chat...Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India- Ankur chat...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India- Ankur chat...
Spotle.ai
 
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team La c...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team La c...Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team La c...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team La c...
Spotle.ai
 
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Temp...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Temp...Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Temp...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Temp...
Spotle.ai
 
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Zer...
 Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Zer... Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Zer...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Zer...
Spotle.ai
 
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Shivam Gi...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Shivam Gi...Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Shivam Gi...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Shivam Gi...
Spotle.ai
 
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Cyber Pun...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Cyber Pun...Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Cyber Pun...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Cyber Pun...
Spotle.ai
 
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Tech Owls...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Tech Owls...Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Tech Owls...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Tech Owls...
Spotle.ai
 
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Jar...
 Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Jar... Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Jar...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Jar...
Spotle.ai
 
Artificial intelligence in fintech
Artificial intelligence in fintechArtificial intelligence in fintech
Artificial intelligence in fintech
Spotle.ai
 
Semi-supervised Machine Learning
Semi-supervised Machine LearningSemi-supervised Machine Learning
Semi-supervised Machine Learning
Spotle.ai
 
Basics of Reinforcement Learning
Basics of Reinforcement LearningBasics of Reinforcement Learning
Basics of Reinforcement Learning
Spotle.ai
 
Tableau And Data Visualization - Get Started
Tableau And Data Visualization - Get StartedTableau And Data Visualization - Get Started
Tableau And Data Visualization - Get Started
Spotle.ai
 
Artificial Intelligence in FinTech
Artificial Intelligence in FinTechArtificial Intelligence in FinTech
Artificial Intelligence in FinTech
Spotle.ai
 
Supervised and Unsupervised Machine Learning
Supervised and Unsupervised Machine LearningSupervised and Unsupervised Machine Learning
Supervised and Unsupervised Machine Learning
Spotle.ai
 
Growing-up With AI
Growing-up With AIGrowing-up With AI
Growing-up With AI
Spotle.ai
 
AI And Cyber-security Threats
AI And Cyber-security ThreatsAI And Cyber-security Threats
AI And Cyber-security Threats
Spotle.ai
 
Robotic Process Automation With Blue Prism
Robotic Process Automation With Blue PrismRobotic Process Automation With Blue Prism
Robotic Process Automation With Blue Prism
Spotle.ai
 

More from Spotle.ai (20)

Spotle AI-thon - AI For Good Business Plan Showcase - Team IIM Indore - AI Ro...
Spotle AI-thon - AI For Good Business Plan Showcase - Team IIM Indore - AI Ro...Spotle AI-thon - AI For Good Business Plan Showcase - Team IIM Indore - AI Ro...
Spotle AI-thon - AI For Good Business Plan Showcase - Team IIM Indore - AI Ro...
 
Spotle AI-thon - AI For Good Business Plan Showcase - Cummins College
Spotle AI-thon - AI For Good Business Plan Showcase - Cummins CollegeSpotle AI-thon - AI For Good Business Plan Showcase - Cummins College
Spotle AI-thon - AI For Good Business Plan Showcase - Cummins College
 
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Elit...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Elit...Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Elit...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Elit...
 
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India- Ankur chat...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India- Ankur chat...Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India- Ankur chat...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India- Ankur chat...
 
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team La c...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team La c...Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team La c...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team La c...
 
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Temp...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Temp...Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Temp...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Temp...
 
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Zer...
 Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Zer... Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Zer...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Zer...
 
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Shivam Gi...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Shivam Gi...Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Shivam Gi...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Shivam Gi...
 
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Cyber Pun...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Cyber Pun...Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Cyber Pun...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Cyber Pun...
 
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Tech Owls...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Tech Owls...Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Tech Owls...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Tech Owls...
 
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Jar...
 Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Jar... Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Jar...
Spotle AI-thon Top 10 Showcase - Analysing Mental Health Of India - Team Jar...
 
Artificial intelligence in fintech
Artificial intelligence in fintechArtificial intelligence in fintech
Artificial intelligence in fintech
 
Semi-supervised Machine Learning
Semi-supervised Machine LearningSemi-supervised Machine Learning
Semi-supervised Machine Learning
 
Basics of Reinforcement Learning
Basics of Reinforcement LearningBasics of Reinforcement Learning
Basics of Reinforcement Learning
 
Tableau And Data Visualization - Get Started
Tableau And Data Visualization - Get StartedTableau And Data Visualization - Get Started
Tableau And Data Visualization - Get Started
 
Artificial Intelligence in FinTech
Artificial Intelligence in FinTechArtificial Intelligence in FinTech
Artificial Intelligence in FinTech
 
Supervised and Unsupervised Machine Learning
Supervised and Unsupervised Machine LearningSupervised and Unsupervised Machine Learning
Supervised and Unsupervised Machine Learning
 
Growing-up With AI
Growing-up With AIGrowing-up With AI
Growing-up With AI
 
AI And Cyber-security Threats
AI And Cyber-security ThreatsAI And Cyber-security Threats
AI And Cyber-security Threats
 
Robotic Process Automation With Blue Prism
Robotic Process Automation With Blue PrismRobotic Process Automation With Blue Prism
Robotic Process Automation With Blue Prism
 

Recently uploaded

Streamlining End-to-End Testing Automation
Streamlining End-to-End Testing AutomationStreamlining End-to-End Testing Automation
Streamlining End-to-End Testing Automation
Anand Bagmar
 
Flutter vs. React Native: A Detailed Comparison for App Development in 2024
Flutter vs. React Native: A Detailed Comparison for App Development in 2024Flutter vs. React Native: A Detailed Comparison for App Development in 2024
Flutter vs. React Native: A Detailed Comparison for App Development in 2024
dhavalvaghelanectarb
 
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom KittEnhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Peter Caitens
 
Software Test Automation - A Comprehensive Guide on Automated Testing.pdf
Software Test Automation - A Comprehensive Guide on Automated Testing.pdfSoftware Test Automation - A Comprehensive Guide on Automated Testing.pdf
Software Test Automation - A Comprehensive Guide on Automated Testing.pdf
kalichargn70th171
 
42 Ways to Generate Real Estate Leads - Sellxpert
42 Ways to Generate Real Estate Leads - Sellxpert42 Ways to Generate Real Estate Leads - Sellxpert
42 Ways to Generate Real Estate Leads - Sellxpert
vaishalijagtap12
 
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
campbellclarkson
 
Penify - Let AI do the Documentation, you write the Code.
Penify - Let AI do the Documentation, you write the Code.Penify - Let AI do the Documentation, you write the Code.
Penify - Let AI do the Documentation, you write the Code.
KrishnaveniMohan1
 
Transforming Product Development using OnePlan To Boost Efficiency and Innova...
Transforming Product Development using OnePlan To Boost Efficiency and Innova...Transforming Product Development using OnePlan To Boost Efficiency and Innova...
Transforming Product Development using OnePlan To Boost Efficiency and Innova...
OnePlan Solutions
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
kalichargn70th171
 
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
kgyxske
 
Orca: Nocode Graphical Editor for Container Orchestration
Orca: Nocode Graphical Editor for Container OrchestrationOrca: Nocode Graphical Editor for Container Orchestration
Orca: Nocode Graphical Editor for Container Orchestration
Pedro J. Molina
 
Stork Product Overview: An AI-Powered Autonomous Delivery Fleet
Stork Product Overview: An AI-Powered Autonomous Delivery FleetStork Product Overview: An AI-Powered Autonomous Delivery Fleet
Stork Product Overview: An AI-Powered Autonomous Delivery Fleet
Vince Scalabrino
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
dakas1
 
Superpower Your Apache Kafka Applications Development with Complementary Open...
Superpower Your Apache Kafka Applications Development with Complementary Open...Superpower Your Apache Kafka Applications Development with Complementary Open...
Superpower Your Apache Kafka Applications Development with Complementary Open...
Paul Brebner
 
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdfBaha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid
 
ppt on the brain chip neuralink.pptx
ppt  on   the brain  chip neuralink.pptxppt  on   the brain  chip neuralink.pptx
ppt on the brain chip neuralink.pptx
Reetu63
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
ShulagnaSarkar2
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
The Third Creative Media
 

Recently uploaded (20)

Streamlining End-to-End Testing Automation
Streamlining End-to-End Testing AutomationStreamlining End-to-End Testing Automation
Streamlining End-to-End Testing Automation
 
Flutter vs. React Native: A Detailed Comparison for App Development in 2024
Flutter vs. React Native: A Detailed Comparison for App Development in 2024Flutter vs. React Native: A Detailed Comparison for App Development in 2024
Flutter vs. React Native: A Detailed Comparison for App Development in 2024
 
bgiolcb
bgiolcbbgiolcb
bgiolcb
 
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom KittEnhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
 
Software Test Automation - A Comprehensive Guide on Automated Testing.pdf
Software Test Automation - A Comprehensive Guide on Automated Testing.pdfSoftware Test Automation - A Comprehensive Guide on Automated Testing.pdf
Software Test Automation - A Comprehensive Guide on Automated Testing.pdf
 
42 Ways to Generate Real Estate Leads - Sellxpert
42 Ways to Generate Real Estate Leads - Sellxpert42 Ways to Generate Real Estate Leads - Sellxpert
42 Ways to Generate Real Estate Leads - Sellxpert
 
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
 
Penify - Let AI do the Documentation, you write the Code.
Penify - Let AI do the Documentation, you write the Code.Penify - Let AI do the Documentation, you write the Code.
Penify - Let AI do the Documentation, you write the Code.
 
Transforming Product Development using OnePlan To Boost Efficiency and Innova...
Transforming Product Development using OnePlan To Boost Efficiency and Innova...Transforming Product Development using OnePlan To Boost Efficiency and Innova...
Transforming Product Development using OnePlan To Boost Efficiency and Innova...
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
 
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
 
Orca: Nocode Graphical Editor for Container Orchestration
Orca: Nocode Graphical Editor for Container OrchestrationOrca: Nocode Graphical Editor for Container Orchestration
Orca: Nocode Graphical Editor for Container Orchestration
 
Stork Product Overview: An AI-Powered Autonomous Delivery Fleet
Stork Product Overview: An AI-Powered Autonomous Delivery FleetStork Product Overview: An AI-Powered Autonomous Delivery Fleet
Stork Product Overview: An AI-Powered Autonomous Delivery Fleet
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
Superpower Your Apache Kafka Applications Development with Complementary Open...
Superpower Your Apache Kafka Applications Development with Complementary Open...Superpower Your Apache Kafka Applications Development with Complementary Open...
Superpower Your Apache Kafka Applications Development with Complementary Open...
 
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdfBaha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
 
ppt on the brain chip neuralink.pptx
ppt  on   the brain  chip neuralink.pptxppt  on   the brain  chip neuralink.pptx
ppt on the brain chip neuralink.pptx
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
 

Introduction To Algorithms

  • 2. Spotle.ai Study Material Spotle.ai/Learn Gift him a shampoo pack with instructions: - Lather - Rinse - Repeat How Do You Keep A Software Engineer Shampooing Forever? Img Src: Wikipedia 2
  • 3. Spotle.ai Study Material Spotle.ai/Learn Have you figured out which direction to go yet? Ambiguous Instructions Stump Everyone Not Just Software Engineers Img Src: pinterest 3
  • 4. Spotle.ai Study Material Spotle.ai/Learn Machines Need Clear Instructions Too 4 A computer executes a program which is nothing but a sequence of codified instructions.
  • 5. Spotle.ai Study Material Spotle.ai/Learn What Is An Algorithm? Img Src: pandora 5 The sequence of steps to solve a specific problem or attain a specific goal is called an algorithm.
  • 6. Spotle.ai Study Material Spotle.ai/Learn Machines need clear instructions to solve a problem optimally. You need to feed your machine the right algorithm to get the correct result within minimum resources (time, CPU units, memory). Why Are Algorithms Important? Img Src: pchelp 6
  • 7. Spotle.ai Study Material Spotle.ai/Learn The Software Development Life Cycle 7 Problem Definition Requirement Analysis Define Algorithm Develop Program Testing and Deployment
  • 8. Spotle.ai Study Material Spotle.ai/Learn As a software engineer, your key responsibility will be to understand business problems and find the best path to solve them. In short this is what your daily task will look like: PROBLEM -----------> SOLUTION Algorithm What Software Engineers Do 8
  • 9. Spotle.ai Study Material Spotle.ai/Learn Input and Output Finite Correct Definite Effective Characteristics Of An Algorithm 9
  • 10. Spotle.ai Study Material Spotle.ai/Learn Efficiency Of An Algorithm 10 Efficiency Of The Algorithm Space Complexity Time Complexity
  • 11. Spotle.ai Study Material Spotle.ai/Learn Time complexity of an algorithm denotes the amount of time taken by an algorithm to run, expressed as a function of the length of the input. Time complexity actually measures the number of steps the algorithm executes rather than the actual time taken which depends also on factors like processor speed, network load etc. Time Complexity 11
  • 12. Spotle.ai Study Material Spotle.ai/Learn Space Complexity of an algorithm is total space taken by the algorithm as a function of the input size.  Space Complexity 12
  • 13. Spotle.ai Study Material Spotle.ai/Learn The Big O 13 My algorithms are O(1). Big O describes the performance or complexity of an algorithm. It denotes the worst-case scenario, and can be used to describe the execution time required or the space used (e.g. in memory or on disk) by an algorithm. The Big O denotes the order of the algorithm as a function of its input size: eg O(1), O(n), O(logn).
  • 14. Spotle.ai Study Material Spotle.ai/Learn O(1) algorithms always take a constant amount of time irrespective of the size of the input. For example, the algorithm to check if the first number in a list is 5 will always take constant time irrespective of the size of the list. O(1) Algorithms 14 1 3 4 5 8 3 2 22 223 O(1) O(1) Is this 5? Is this 5?
  • 15. Spotle.ai Study Material Spotle.ai/Learn 
 Say you have a jumbled up list of 8 numbers. You have to find if number 5 is in the list. What will you do? Pick each number If number = 5, terminate. If number is not equal to 5, keep number aside. Search the rest of the numbers. In the worst case you have to do this n = 8 times. The algorithm has complexity = O(n). O(n) Algorithms 15 3 100 15 2 1 8 20 5 Is this 5? Is this 5? Is this 5? Is this 5? Is this 5? Is this 5? Is this 5? Is this 5?
  • 16. Spotle.ai Study Material Spotle.ai/Learn Say the list in the last example is now sorted. How much time will you take to find 5 in the list? O(logn) Algorithms 16 1 2 5 7 15 20 22 100
  • 17. Spotle.ai Study Material Spotle.ai/Learn Pass 1: Divide the list into 2. Compare 5 to the largest (bottom-most number) in upper partition. Since 5 < 7, 5 will be in the upper partition. Discard lower partition. O(logn) Algorithms 17 1 2 5 7 15 20 22 100
  • 18. Spotle.ai Study Material Spotle.ai/Learn Pass 2: Divide the list from pass1 into 2 halves. Compare 5 with the largest number in the upper partition. Since 5 > 2, 5 must be in the lower partition. Discard the upper partition O(logn) Algorithms 18 1 2 5 7
  • 19. Spotle.ai Study Material Spotle.ai/Learn Pass 3: Divide the list from pass 2 into 2 halves. Compare 5 with the largest number (the lower-most number) in the upper partition. You have found your 5! O(logn) Algorithms 19 5 7
  • 20. Spotle.ai Study Material Spotle.ai/Learn In this algorithm you are halving the input set till you have partitions of 1. How many times do you have to repeat the operation of halving the set? Let k be the number of times the set is halved Then n/2k = 1 or k = log2n O(logn) Algorithms 20 5 7 1 2 5 7 15 20 22 100 1 2 5 7
  • 21. Spotle.ai Study Material Spotle.ai/Learn The Problem: Find the smallest number in the list The easiest solution is to take each number in the list and compare to all other numbers in the list to see if it is the smallest number. For a list of size 3, in the worst case this will be done 3 x 3 times or 9 times. The algorithm has complexity O(n2) O(n2) Algorithms 21 20 7 5 20 7 5 O(n2) Comparisons
  • 22. Spotle.ai Study Material Spotle.ai/Learn Is there a more efficient way of finding the smallest number in a list? Lets designate the first number in the list, in this case 20 as the smallest number. Compare each number in the list with the smallest number. If the number is smaller than the smallest number, set smallest number = number. You are repeating this n=3 times. The complexity is O(n). Reducing Algorithmic Complexity 22 20 5 7 20 20 5 7 5 20 5 7 5 1st pass. 20 is taken to be smallest 2nd pass. 5 is taken to be smallest; because 5 is smaller than 20. 3rd pass. 5 stands as the smallest; because 5 is smaller than 7.
  • 23. Spotle.ai Study Material Spotle.ai/Learn While designing complex systems, large systems are broken down into modules. This process is called modularization. Modular Approach To System Design Img Src: Wikipedia 23 Design Engine Design Body Design Storage
  • 24. Spotle.ai Study Material Spotle.ai/Learn Understand Problem Modularize Problem Evaluate Algorithms Choose Most Optimal Algorithm Convert To Code Problem Solution Approach 24