SlideShare a Scribd company logo
1 of 24
Download to read offline
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 wayKir Chou
 
Python-01| Fundamentals
Python-01| FundamentalsPython-01| Fundamentals
Python-01| FundamentalsMohd Sajjad
 
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 | EdurekaEdureka!
 
Introduction To Programming with Python-3
Introduction To Programming with Python-3Introduction To Programming with Python-3
Introduction To Programming with Python-3Syed Farjad Zia Zaidi
 
Python for Scientific Computing
Python for Scientific ComputingPython for Scientific Computing
Python for Scientific ComputingAlbert DeFusco
 
Python programming msc(cs)
Python programming msc(cs)Python programming msc(cs)
Python programming msc(cs)KALAISELVI P
 
Python programming
Python programmingPython programming
Python programmingsaroja20
 
Python programming
Python programmingPython programming
Python programmingsaroja20
 
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 commentsNilimesh Halder
 
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 10Osama 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 SaghafiProfessor Lili Saghafi
 

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

Small Basic Calculator Apps lesson
Small Basic Calculator Apps lessonSmall Basic Calculator Apps lesson
Small Basic Calculator Apps lessonEdujetage
 
Lecture-1-Algorithms.pptx
Lecture-1-Algorithms.pptxLecture-1-Algorithms.pptx
Lecture-1-Algorithms.pptxxalahama3
 
Introduction to Algorithms
Introduction to AlgorithmsIntroduction to Algorithms
Introduction to AlgorithmsMohamed Essam
 
Unit 1-problem solving with algorithm
Unit 1-problem solving with algorithmUnit 1-problem solving with algorithm
Unit 1-problem solving with algorithmrajkumar1631010038
 
Mastering Python lesson 3a
Mastering Python lesson 3aMastering Python lesson 3a
Mastering Python lesson 3aRuth 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ø
 
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 PythonTariq 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.docxmary772
 
9 big o-notation
9 big o-notation9 big o-notation
9 big o-notationirdginfo
 
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 applicationsyazad dumasia
 
Questions4
Questions4Questions4
Questions4hccit
 
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.pdfRameshaFernando2
 
Learn python
Learn pythonLearn python
Learn pythonmocninja
 
Python Interview Questions And Answers
Python Interview Questions And AnswersPython Interview Questions And Answers
Python Interview Questions And AnswersH2Kinfosys
 

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 CollegeSpotle.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 fintechSpotle.ai
 
Semi-supervised Machine Learning
Semi-supervised Machine LearningSemi-supervised Machine Learning
Semi-supervised Machine LearningSpotle.ai
 
Basics of Reinforcement Learning
Basics of Reinforcement LearningBasics of Reinforcement Learning
Basics of Reinforcement LearningSpotle.ai
 
Tableau And Data Visualization - Get Started
Tableau And Data Visualization - Get StartedTableau And Data Visualization - Get Started
Tableau And Data Visualization - Get StartedSpotle.ai
 
Artificial Intelligence in FinTech
Artificial Intelligence in FinTechArtificial Intelligence in FinTech
Artificial Intelligence in FinTechSpotle.ai
 
Supervised and Unsupervised Machine Learning
Supervised and Unsupervised Machine LearningSupervised and Unsupervised Machine Learning
Supervised and Unsupervised Machine LearningSpotle.ai
 
Growing-up With AI
Growing-up With AIGrowing-up With AI
Growing-up With AISpotle.ai
 
AI And Cyber-security Threats
AI And Cyber-security ThreatsAI And Cyber-security Threats
AI And Cyber-security ThreatsSpotle.ai
 
Robotic Process Automation With Blue Prism
Robotic Process Automation With Blue PrismRobotic Process Automation With Blue Prism
Robotic Process Automation With Blue PrismSpotle.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

Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 

Recently uploaded (20)

Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 

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