SlideShare una empresa de Scribd logo
1 de 15
Warshall’s Algorithm
&
Dynamic Programming
BY
DEBARATI DAS ( CS-52)
Key Points OF Discussion
1
• FB vs Google+ (graph types)
• Transitive Closure
2
• Explanation of Warshall Algorithm
• Complexity Analysis
3
• Applications of Warshall Algorithm
FB Vs Google+
Transitive Closure
1
• What is Transitivity ?
• Express it in a graph :
2
• What is Transitive Closure ?
• Express as a Matrix :
• How can we find Transitive Closure of A
Graph ?
Finding Transitive Closure
• Involves searching for the shortest path
starting at every vertex.
• If you start at ith vertex, after traversal you
get columns containing 1 in the ith row.
• Clearly it has a disadvantage (?)
DFS
Implementation
• It involves finding the shortest path and
improving the estimate on the path every
single time, till its optimal.
• However, this fails in case of negative
cycles.
Basic Point of
The Warshall
Algorithm
Warshall Algorithm : Visitation
Example
Warshall Algorithm : Weighted
Example
Warshall Algorithm, brief
Complexity Analysis :
In this Bottom up Dynamic approach,
D0 -> 0
D1 -> n2 problems , every problem is a value in a cell.
n2xn where n2 denotes subproblems and n is no of matrices
So,total number of problems that need to be solved are n3
Therefore Time complexity is O(n3)
Space Complexity :
D1->D0
D2->D1
D3->D2
At any point of time you need two matrices so O(n2)
Applications of Warshall Algorithm
1. Shortest Path in Directed Graphs
2. Optimal Routing
3. Check if a graph is Bipartite
4. Pathfinder Networks
5. Inversion of Real Networks
(Gauss Jordan Method)
Key Questions
1
• What is the difference between D&C and DP ?
• What is Dynamic Programming ?
• Why is it called “Dynamic” ?
2
• What is Space Time Trade off ?
• How is it implemented by DP ?
• What are the applications of DP ?
• What is a non optimizable problem ?
3
• What is transitive Closure ?
• Warshall Algorithm discussion
Fibonacci Series : An illustration
fib(5)
fib(4) fib(3)
fib(3) fib(2) fib(2) fib(1)
fib(2) fib(1) fib(1) fib(0) fib(1) fib(0)
fib(1) fib(0)
6
5
21
3
4
Divide and Conquer vs D.P
 Clearly If We use Divide and Conquer, We face
OVER LAP.
 Mostly values are calculated again and again,
so even though access of function is O(1) , the
total time complexity is exponential or O(2n).
 INSTEAD if we used DP. We would store each
value in a table and access when required.
 DP Time complexity becomes O(n)
Why is it called “Dynamic
Programming” ?
Dynamic Programming : Basic Idea
 Avoid calculating the same thing twice by keeping a table of
known results, which we fill up as subinstances are solved.
 Dynamic programming is a bottom-up / top down technique
 Bottom up dynamic programming evaluates by computing all
function values in order, starting at lowest and using previously
computed values.
 Can MERGE SORT Be solved using DP ?

Más contenido relacionado

La actualidad más candente

Network Security (Revised Syllabus) [QP / April - 2015]
Network Security (Revised Syllabus) [QP / April - 2015]Network Security (Revised Syllabus) [QP / April - 2015]
Network Security (Revised Syllabus) [QP / April - 2015]Mumbai B.Sc.IT Study
 
[Question Paper] Network Security (Revised Syllabus) [October / 2012]
[Question Paper] Network Security (Revised Syllabus) [October / 2012][Question Paper] Network Security (Revised Syllabus) [October / 2012]
[Question Paper] Network Security (Revised Syllabus) [October / 2012]Mumbai B.Sc.IT Study
 
B.Sc.IT: Semester - VI (April - 2015) [IDOL - Revised Course | Question Paper]
B.Sc.IT: Semester - VI (April - 2015) [IDOL - Revised Course | Question Paper]B.Sc.IT: Semester - VI (April - 2015) [IDOL - Revised Course | Question Paper]
B.Sc.IT: Semester - VI (April - 2015) [IDOL - Revised Course | Question Paper]Mumbai B.Sc.IT Study
 
[Question Paper] Network Security (75:25 Pattern) [November / 2015]
[Question Paper] Network Security (75:25 Pattern) [November / 2015][Question Paper] Network Security (75:25 Pattern) [November / 2015]
[Question Paper] Network Security (75:25 Pattern) [November / 2015]Mumbai B.Sc.IT Study
 
B.Sc.IT: Semester - VI (May - 2018) [IDOL - Revised Course | Question Paper]
B.Sc.IT: Semester - VI (May - 2018) [IDOL - Revised Course | Question Paper]B.Sc.IT: Semester - VI (May - 2018) [IDOL - Revised Course | Question Paper]
B.Sc.IT: Semester - VI (May - 2018) [IDOL - Revised Course | Question Paper]Mumbai B.Sc.IT Study
 
[Question Paper] Network Security (Revised Syllabus) [April / 2015]
[Question Paper] Network Security (Revised Syllabus) [April / 2015][Question Paper] Network Security (Revised Syllabus) [April / 2015]
[Question Paper] Network Security (Revised Syllabus) [April / 2015]Mumbai B.Sc.IT Study
 
Network Security (Revised Syllabus) [QP / October - 2012]
Network Security (Revised Syllabus) [QP / October - 2012]Network Security (Revised Syllabus) [QP / October - 2012]
Network Security (Revised Syllabus) [QP / October - 2012]Mumbai B.Sc.IT Study
 
Java and Data Structure (October - 2016) [Revised Course | Question Paper]
Java and Data Structure (October - 2016) [Revised Course | Question Paper]Java and Data Structure (October - 2016) [Revised Course | Question Paper]
Java and Data Structure (October - 2016) [Revised Course | Question Paper]Mumbai B.Sc.IT Study
 
Breadth first search signed
Breadth first search signedBreadth first search signed
Breadth first search signedAfshanKhan51
 
Network Security (Revised Syllabus) [QP / April - 2014]
Network Security (Revised Syllabus) [QP / April - 2014]Network Security (Revised Syllabus) [QP / April - 2014]
Network Security (Revised Syllabus) [QP / April - 2014]Mumbai B.Sc.IT Study
 
Multi-Target Machine Translation with Multi-Synchronous Context-free Grammars...
Multi-Target Machine Translation with Multi-Synchronous Context-free Grammars...Multi-Target Machine Translation with Multi-Synchronous Context-free Grammars...
Multi-Target Machine Translation with Multi-Synchronous Context-free Grammars...Shin Kanouchi
 
artificial intelligence
artificial intelligence artificial intelligence
artificial intelligence ilias ahmed
 
Digital Signals and Systems (December – 2017) [Question Paper | IDOL: Revised...
Digital Signals and Systems (December – 2017) [Question Paper | IDOL: Revised...Digital Signals and Systems (December – 2017) [Question Paper | IDOL: Revised...
Digital Signals and Systems (December – 2017) [Question Paper | IDOL: Revised...Mumbai B.Sc.IT Study
 
Uninformed Search technique
Uninformed Search techniqueUninformed Search technique
Uninformed Search techniqueKapil Dahal
 
Java and Data Structure (September - 2013) [Revised Course | Question Paper]
Java and Data Structure (September - 2013) [Revised Course | Question Paper]Java and Data Structure (September - 2013) [Revised Course | Question Paper]
Java and Data Structure (September - 2013) [Revised Course | Question Paper]Mumbai B.Sc.IT Study
 
A small debate of power of randomness
A small debate of power of randomnessA small debate of power of randomness
A small debate of power of randomnessAbner Chih Yi Huang
 
[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...
[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...
[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...Mumbai B.Sc.IT Study
 

La actualidad más candente (20)

Network Security (Revised Syllabus) [QP / April - 2015]
Network Security (Revised Syllabus) [QP / April - 2015]Network Security (Revised Syllabus) [QP / April - 2015]
Network Security (Revised Syllabus) [QP / April - 2015]
 
[Question Paper] Network Security (Revised Syllabus) [October / 2012]
[Question Paper] Network Security (Revised Syllabus) [October / 2012][Question Paper] Network Security (Revised Syllabus) [October / 2012]
[Question Paper] Network Security (Revised Syllabus) [October / 2012]
 
Search
SearchSearch
Search
 
B.Sc.IT: Semester - VI (April - 2015) [IDOL - Revised Course | Question Paper]
B.Sc.IT: Semester - VI (April - 2015) [IDOL - Revised Course | Question Paper]B.Sc.IT: Semester - VI (April - 2015) [IDOL - Revised Course | Question Paper]
B.Sc.IT: Semester - VI (April - 2015) [IDOL - Revised Course | Question Paper]
 
[Question Paper] Network Security (75:25 Pattern) [November / 2015]
[Question Paper] Network Security (75:25 Pattern) [November / 2015][Question Paper] Network Security (75:25 Pattern) [November / 2015]
[Question Paper] Network Security (75:25 Pattern) [November / 2015]
 
B.Sc.IT: Semester - VI (May - 2018) [IDOL - Revised Course | Question Paper]
B.Sc.IT: Semester - VI (May - 2018) [IDOL - Revised Course | Question Paper]B.Sc.IT: Semester - VI (May - 2018) [IDOL - Revised Course | Question Paper]
B.Sc.IT: Semester - VI (May - 2018) [IDOL - Revised Course | Question Paper]
 
[Question Paper] Network Security (Revised Syllabus) [April / 2015]
[Question Paper] Network Security (Revised Syllabus) [April / 2015][Question Paper] Network Security (Revised Syllabus) [April / 2015]
[Question Paper] Network Security (Revised Syllabus) [April / 2015]
 
Network Security (Revised Syllabus) [QP / October - 2012]
Network Security (Revised Syllabus) [QP / October - 2012]Network Security (Revised Syllabus) [QP / October - 2012]
Network Security (Revised Syllabus) [QP / October - 2012]
 
Java and Data Structure (October - 2016) [Revised Course | Question Paper]
Java and Data Structure (October - 2016) [Revised Course | Question Paper]Java and Data Structure (October - 2016) [Revised Course | Question Paper]
Java and Data Structure (October - 2016) [Revised Course | Question Paper]
 
Breadth first search signed
Breadth first search signedBreadth first search signed
Breadth first search signed
 
NP completeness
NP completenessNP completeness
NP completeness
 
Network Security (Revised Syllabus) [QP / April - 2014]
Network Security (Revised Syllabus) [QP / April - 2014]Network Security (Revised Syllabus) [QP / April - 2014]
Network Security (Revised Syllabus) [QP / April - 2014]
 
Multi-Target Machine Translation with Multi-Synchronous Context-free Grammars...
Multi-Target Machine Translation with Multi-Synchronous Context-free Grammars...Multi-Target Machine Translation with Multi-Synchronous Context-free Grammars...
Multi-Target Machine Translation with Multi-Synchronous Context-free Grammars...
 
artificial intelligence
artificial intelligence artificial intelligence
artificial intelligence
 
Complexity theory
Complexity theory Complexity theory
Complexity theory
 
Digital Signals and Systems (December – 2017) [Question Paper | IDOL: Revised...
Digital Signals and Systems (December – 2017) [Question Paper | IDOL: Revised...Digital Signals and Systems (December – 2017) [Question Paper | IDOL: Revised...
Digital Signals and Systems (December – 2017) [Question Paper | IDOL: Revised...
 
Uninformed Search technique
Uninformed Search techniqueUninformed Search technique
Uninformed Search technique
 
Java and Data Structure (September - 2013) [Revised Course | Question Paper]
Java and Data Structure (September - 2013) [Revised Course | Question Paper]Java and Data Structure (September - 2013) [Revised Course | Question Paper]
Java and Data Structure (September - 2013) [Revised Course | Question Paper]
 
A small debate of power of randomness
A small debate of power of randomnessA small debate of power of randomness
A small debate of power of randomness
 
[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...
[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...
[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...
 

Destacado

Freeing India of “Divide & Rule”
Freeing India of “Divide & Rule” Freeing India of “Divide & Rule”
Freeing India of “Divide & Rule” cvikash
 
Randomized Algorithms in Linear Algebra & the Column Subset Selection Problem
Randomized Algorithms in Linear Algebra & the Column Subset Selection ProblemRandomized Algorithms in Linear Algebra & the Column Subset Selection Problem
Randomized Algorithms in Linear Algebra & the Column Subset Selection ProblemWei Xue
 
Dynamic programming in Algorithm Analysis
Dynamic programming in Algorithm AnalysisDynamic programming in Algorithm Analysis
Dynamic programming in Algorithm AnalysisRajendran
 
Greedyalgorithm
Greedyalgorithm Greedyalgorithm
Greedyalgorithm Diksha Lad
 
Floyd Warshall algorithm easy way to compute - Malinga
Floyd Warshall algorithm easy way to compute - MalingaFloyd Warshall algorithm easy way to compute - Malinga
Floyd Warshall algorithm easy way to compute - MalingaMalinga Perera
 
Solving The Shortest Path Tour Problem
Solving The Shortest Path Tour ProblemSolving The Shortest Path Tour Problem
Solving The Shortest Path Tour ProblemNozir Shokirov
 
Load Balancing with Apache
Load Balancing with ApacheLoad Balancing with Apache
Load Balancing with ApacheBradley Holt
 
5.5 back track
5.5 back track5.5 back track
5.5 back trackKrish_ver2
 
Subset sum problem Dynamic and Brute Force Approch
Subset sum problem Dynamic and Brute Force ApprochSubset sum problem Dynamic and Brute Force Approch
Subset sum problem Dynamic and Brute Force ApprochIjlal Ijlal
 
Covering (Rules-based) Algorithm
Covering (Rules-based) AlgorithmCovering (Rules-based) Algorithm
Covering (Rules-based) AlgorithmZHAO Sam
 

Destacado (20)

Greedy Algorihm
Greedy AlgorihmGreedy Algorihm
Greedy Algorihm
 
Freeing India of “Divide & Rule”
Freeing India of “Divide & Rule” Freeing India of “Divide & Rule”
Freeing India of “Divide & Rule”
 
Randomized Algorithms in Linear Algebra & the Column Subset Selection Problem
Randomized Algorithms in Linear Algebra & the Column Subset Selection ProblemRandomized Algorithms in Linear Algebra & the Column Subset Selection Problem
Randomized Algorithms in Linear Algebra & the Column Subset Selection Problem
 
Chap08alg
Chap08algChap08alg
Chap08alg
 
Dynamic programming in Algorithm Analysis
Dynamic programming in Algorithm AnalysisDynamic programming in Algorithm Analysis
Dynamic programming in Algorithm Analysis
 
Load balancing
Load balancingLoad balancing
Load balancing
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
 
Introduction to-sql
Introduction to-sqlIntroduction to-sql
Introduction to-sql
 
Greedyalgorithm
Greedyalgorithm Greedyalgorithm
Greedyalgorithm
 
Floyd Warshall algorithm easy way to compute - Malinga
Floyd Warshall algorithm easy way to compute - MalingaFloyd Warshall algorithm easy way to compute - Malinga
Floyd Warshall algorithm easy way to compute - Malinga
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
 
(floyd's algm)
(floyd's algm)(floyd's algm)
(floyd's algm)
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
 
Solving The Shortest Path Tour Problem
Solving The Shortest Path Tour ProblemSolving The Shortest Path Tour Problem
Solving The Shortest Path Tour Problem
 
21 backtracking
21 backtracking21 backtracking
21 backtracking
 
Load Balancing with Apache
Load Balancing with ApacheLoad Balancing with Apache
Load Balancing with Apache
 
DP
DPDP
DP
 
5.5 back track
5.5 back track5.5 back track
5.5 back track
 
Subset sum problem Dynamic and Brute Force Approch
Subset sum problem Dynamic and Brute Force ApprochSubset sum problem Dynamic and Brute Force Approch
Subset sum problem Dynamic and Brute Force Approch
 
Covering (Rules-based) Algorithm
Covering (Rules-based) AlgorithmCovering (Rules-based) Algorithm
Covering (Rules-based) Algorithm
 

Similar a Class warshal2

Search algorithms for discrete optimization
Search algorithms for discrete optimizationSearch algorithms for discrete optimization
Search algorithms for discrete optimizationSally Salem
 
Distributed computation and reconfiguration in actively dynamic networks
Distributed computation and reconfiguration in actively dynamic networksDistributed computation and reconfiguration in actively dynamic networks
Distributed computation and reconfiguration in actively dynamic networksPeter Kos
 
Genetic programming
Genetic programmingGenetic programming
Genetic programmingYun-Yan Chi
 
Lecture 16 - Dijkstra's Algorithm.pdf
Lecture 16 - Dijkstra's Algorithm.pdfLecture 16 - Dijkstra's Algorithm.pdf
Lecture 16 - Dijkstra's Algorithm.pdfiftakhar8
 
The Factoring Dead: Preparing for the Cryptopocalypse
The Factoring Dead: Preparing for the CryptopocalypseThe Factoring Dead: Preparing for the Cryptopocalypse
The Factoring Dead: Preparing for the CryptopocalypseAlex Stamos
 
Online learning, Vowpal Wabbit and Hadoop
Online learning, Vowpal Wabbit and HadoopOnline learning, Vowpal Wabbit and Hadoop
Online learning, Vowpal Wabbit and HadoopHéloïse Nonne
 
Discrete Logarithmic Problem- Basis of Elliptic Curve Cryptosystems
Discrete Logarithmic Problem- Basis of Elliptic Curve CryptosystemsDiscrete Logarithmic Problem- Basis of Elliptic Curve Cryptosystems
Discrete Logarithmic Problem- Basis of Elliptic Curve CryptosystemsNIT Sikkim
 
AI - Backtracking vs Depth-First Search (DFS)
AI - Backtracking vs Depth-First Search (DFS)AI - Backtracking vs Depth-First Search (DFS)
AI - Backtracking vs Depth-First Search (DFS)Johnnatan Messias
 
Shor's discrete logarithm quantum algorithm for elliptic curves
 Shor's discrete logarithm quantum algorithm for elliptic curves Shor's discrete logarithm quantum algorithm for elliptic curves
Shor's discrete logarithm quantum algorithm for elliptic curvesXequeMateShannon
 
Topological Sort Algorithm.pptx
Topological Sort Algorithm.pptxTopological Sort Algorithm.pptx
Topological Sort Algorithm.pptxMuhammadShafi89
 
Better DSL Support for Groovy-Eclipse
Better DSL Support for Groovy-EclipseBetter DSL Support for Groovy-Eclipse
Better DSL Support for Groovy-EclipseAndrew Eisenberg
 
GR8Conf 2011: STS DSL Support
GR8Conf 2011: STS DSL SupportGR8Conf 2011: STS DSL Support
GR8Conf 2011: STS DSL SupportGR8Conf
 
GNAT Pro User Day: Ada 2012, Ravenscar and SPARK running on an Atmel ARM M4 (...
GNAT Pro User Day: Ada 2012, Ravenscar and SPARK running on an Atmel ARM M4 (...GNAT Pro User Day: Ada 2012, Ravenscar and SPARK running on an Atmel ARM M4 (...
GNAT Pro User Day: Ada 2012, Ravenscar and SPARK running on an Atmel ARM M4 (...AdaCore
 
Mediump support in Mesa (XDC 2019)
Mediump support in Mesa (XDC 2019)Mediump support in Mesa (XDC 2019)
Mediump support in Mesa (XDC 2019)Igalia
 
Terascale Learning
Terascale LearningTerascale Learning
Terascale Learningpauldix
 
Bluffers guide to elitist jargon - Martijn Verburg, Richard Warburton, James ...
Bluffers guide to elitist jargon - Martijn Verburg, Richard Warburton, James ...Bluffers guide to elitist jargon - Martijn Verburg, Richard Warburton, James ...
Bluffers guide to elitist jargon - Martijn Verburg, Richard Warburton, James ...JAX London
 

Similar a Class warshal2 (20)

Search algorithms for discrete optimization
Search algorithms for discrete optimizationSearch algorithms for discrete optimization
Search algorithms for discrete optimization
 
Distributed computation and reconfiguration in actively dynamic networks
Distributed computation and reconfiguration in actively dynamic networksDistributed computation and reconfiguration in actively dynamic networks
Distributed computation and reconfiguration in actively dynamic networks
 
Slides
SlidesSlides
Slides
 
Genetic programming
Genetic programmingGenetic programming
Genetic programming
 
Lecture 16 - Dijkstra's Algorithm.pdf
Lecture 16 - Dijkstra's Algorithm.pdfLecture 16 - Dijkstra's Algorithm.pdf
Lecture 16 - Dijkstra's Algorithm.pdf
 
Deep learning
Deep learningDeep learning
Deep learning
 
The Factoring Dead: Preparing for the Cryptopocalypse
The Factoring Dead: Preparing for the CryptopocalypseThe Factoring Dead: Preparing for the Cryptopocalypse
The Factoring Dead: Preparing for the Cryptopocalypse
 
Online learning, Vowpal Wabbit and Hadoop
Online learning, Vowpal Wabbit and HadoopOnline learning, Vowpal Wabbit and Hadoop
Online learning, Vowpal Wabbit and Hadoop
 
Discrete Logarithmic Problem- Basis of Elliptic Curve Cryptosystems
Discrete Logarithmic Problem- Basis of Elliptic Curve CryptosystemsDiscrete Logarithmic Problem- Basis of Elliptic Curve Cryptosystems
Discrete Logarithmic Problem- Basis of Elliptic Curve Cryptosystems
 
AI - Backtracking vs Depth-First Search (DFS)
AI - Backtracking vs Depth-First Search (DFS)AI - Backtracking vs Depth-First Search (DFS)
AI - Backtracking vs Depth-First Search (DFS)
 
Shor's discrete logarithm quantum algorithm for elliptic curves
 Shor's discrete logarithm quantum algorithm for elliptic curves Shor's discrete logarithm quantum algorithm for elliptic curves
Shor's discrete logarithm quantum algorithm for elliptic curves
 
gSpan algorithm
 gSpan algorithm gSpan algorithm
gSpan algorithm
 
gSpan algorithm
gSpan algorithmgSpan algorithm
gSpan algorithm
 
Topological Sort Algorithm.pptx
Topological Sort Algorithm.pptxTopological Sort Algorithm.pptx
Topological Sort Algorithm.pptx
 
Better DSL Support for Groovy-Eclipse
Better DSL Support for Groovy-EclipseBetter DSL Support for Groovy-Eclipse
Better DSL Support for Groovy-Eclipse
 
GR8Conf 2011: STS DSL Support
GR8Conf 2011: STS DSL SupportGR8Conf 2011: STS DSL Support
GR8Conf 2011: STS DSL Support
 
GNAT Pro User Day: Ada 2012, Ravenscar and SPARK running on an Atmel ARM M4 (...
GNAT Pro User Day: Ada 2012, Ravenscar and SPARK running on an Atmel ARM M4 (...GNAT Pro User Day: Ada 2012, Ravenscar and SPARK running on an Atmel ARM M4 (...
GNAT Pro User Day: Ada 2012, Ravenscar and SPARK running on an Atmel ARM M4 (...
 
Mediump support in Mesa (XDC 2019)
Mediump support in Mesa (XDC 2019)Mediump support in Mesa (XDC 2019)
Mediump support in Mesa (XDC 2019)
 
Terascale Learning
Terascale LearningTerascale Learning
Terascale Learning
 
Bluffers guide to elitist jargon - Martijn Verburg, Richard Warburton, James ...
Bluffers guide to elitist jargon - Martijn Verburg, Richard Warburton, James ...Bluffers guide to elitist jargon - Martijn Verburg, Richard Warburton, James ...
Bluffers guide to elitist jargon - Martijn Verburg, Richard Warburton, James ...
 

Más de Debarati Das

Semantic Analysis of a C Program
Semantic Analysis of a C ProgramSemantic Analysis of a C Program
Semantic Analysis of a C ProgramDebarati Das
 
Quiz on Digital Logic and Combinatorial Circuits
Quiz on Digital Logic and Combinatorial CircuitsQuiz on Digital Logic and Combinatorial Circuits
Quiz on Digital Logic and Combinatorial CircuitsDebarati Das
 
Binary Codes and Number System
Binary Codes and Number SystemBinary Codes and Number System
Binary Codes and Number SystemDebarati Das
 
Lattices AND Hasse Diagrams
Lattices AND Hasse DiagramsLattices AND Hasse Diagrams
Lattices AND Hasse DiagramsDebarati Das
 

Más de Debarati Das (6)

Semantic Analysis of a C Program
Semantic Analysis of a C ProgramSemantic Analysis of a C Program
Semantic Analysis of a C Program
 
Carnegie ppt
Carnegie pptCarnegie ppt
Carnegie ppt
 
Quiz on Digital Logic and Combinatorial Circuits
Quiz on Digital Logic and Combinatorial CircuitsQuiz on Digital Logic and Combinatorial Circuits
Quiz on Digital Logic and Combinatorial Circuits
 
Boolean algebra
Boolean algebraBoolean algebra
Boolean algebra
 
Binary Codes and Number System
Binary Codes and Number SystemBinary Codes and Number System
Binary Codes and Number System
 
Lattices AND Hasse Diagrams
Lattices AND Hasse DiagramsLattices AND Hasse Diagrams
Lattices AND Hasse Diagrams
 

Último

Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxsiddharthjain2303
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating SystemRashmi Bhat
 
Crushers to screens in aggregate production
Crushers to screens in aggregate productionCrushers to screens in aggregate production
Crushers to screens in aggregate productionChinnuNinan
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONjhunlian
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm Systemirfanmechengr
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...121011101441
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptMadan Karki
 
Engineering Drawing section of solid
Engineering Drawing     section of solidEngineering Drawing     section of solid
Engineering Drawing section of solidnamansinghjarodiya
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxRomil Mishra
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating SystemRashmi Bhat
 
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Erbil Polytechnic University
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating SystemRashmi Bhat
 
home automation using Arduino by Aditya Prasad
home automation using Arduino by Aditya Prasadhome automation using Arduino by Aditya Prasad
home automation using Arduino by Aditya Prasadaditya806802
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Transport layer issues and challenges - Guide
Transport layer issues and challenges - GuideTransport layer issues and challenges - Guide
Transport layer issues and challenges - GuideGOPINATHS437943
 
National Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdfNational Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdfRajuKanojiya4
 

Último (20)

Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptx
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating System
 
Crushers to screens in aggregate production
Crushers to screens in aggregate productionCrushers to screens in aggregate production
Crushers to screens in aggregate production
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm System
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.ppt
 
Engineering Drawing section of solid
Engineering Drawing     section of solidEngineering Drawing     section of solid
Engineering Drawing section of solid
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptx
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating System
 
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating System
 
home automation using Arduino by Aditya Prasad
home automation using Arduino by Aditya Prasadhome automation using Arduino by Aditya Prasad
home automation using Arduino by Aditya Prasad
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Transport layer issues and challenges - Guide
Transport layer issues and challenges - GuideTransport layer issues and challenges - Guide
Transport layer issues and challenges - Guide
 
National Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdfNational Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdf
 

Class warshal2

  • 2. Key Points OF Discussion 1 • FB vs Google+ (graph types) • Transitive Closure 2 • Explanation of Warshall Algorithm • Complexity Analysis 3 • Applications of Warshall Algorithm
  • 4. Transitive Closure 1 • What is Transitivity ? • Express it in a graph : 2 • What is Transitive Closure ? • Express as a Matrix : • How can we find Transitive Closure of A Graph ?
  • 5. Finding Transitive Closure • Involves searching for the shortest path starting at every vertex. • If you start at ith vertex, after traversal you get columns containing 1 in the ith row. • Clearly it has a disadvantage (?) DFS Implementation • It involves finding the shortest path and improving the estimate on the path every single time, till its optimal. • However, this fails in case of negative cycles. Basic Point of The Warshall Algorithm
  • 6. Warshall Algorithm : Visitation Example
  • 7. Warshall Algorithm : Weighted Example
  • 9. Complexity Analysis : In this Bottom up Dynamic approach, D0 -> 0 D1 -> n2 problems , every problem is a value in a cell. n2xn where n2 denotes subproblems and n is no of matrices So,total number of problems that need to be solved are n3 Therefore Time complexity is O(n3) Space Complexity : D1->D0 D2->D1 D3->D2 At any point of time you need two matrices so O(n2)
  • 10. Applications of Warshall Algorithm 1. Shortest Path in Directed Graphs 2. Optimal Routing 3. Check if a graph is Bipartite 4. Pathfinder Networks 5. Inversion of Real Networks (Gauss Jordan Method)
  • 11. Key Questions 1 • What is the difference between D&C and DP ? • What is Dynamic Programming ? • Why is it called “Dynamic” ? 2 • What is Space Time Trade off ? • How is it implemented by DP ? • What are the applications of DP ? • What is a non optimizable problem ? 3 • What is transitive Closure ? • Warshall Algorithm discussion
  • 12. Fibonacci Series : An illustration fib(5) fib(4) fib(3) fib(3) fib(2) fib(2) fib(1) fib(2) fib(1) fib(1) fib(0) fib(1) fib(0) fib(1) fib(0) 6 5 21 3 4
  • 13. Divide and Conquer vs D.P  Clearly If We use Divide and Conquer, We face OVER LAP.  Mostly values are calculated again and again, so even though access of function is O(1) , the total time complexity is exponential or O(2n).  INSTEAD if we used DP. We would store each value in a table and access when required.  DP Time complexity becomes O(n)
  • 14. Why is it called “Dynamic Programming” ?
  • 15. Dynamic Programming : Basic Idea  Avoid calculating the same thing twice by keeping a table of known results, which we fill up as subinstances are solved.  Dynamic programming is a bottom-up / top down technique  Bottom up dynamic programming evaluates by computing all function values in order, starting at lowest and using previously computed values.  Can MERGE SORT Be solved using DP ?