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
 
GR8Conf 2011: STS DSL Support
GR8Conf 2011: STS DSL SupportGR8Conf 2011: STS DSL Support
GR8Conf 2011: STS DSL SupportGR8Conf
 
Better DSL Support for Groovy-Eclipse
Better DSL Support for Groovy-EclipseBetter DSL Support for Groovy-Eclipse
Better DSL Support for Groovy-EclipseAndrew Eisenberg
 
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
 
GR8Conf 2011: STS DSL Support
GR8Conf 2011: STS DSL SupportGR8Conf 2011: STS DSL Support
GR8Conf 2011: STS DSL Support
 
Better DSL Support for Groovy-Eclipse
Better DSL Support for Groovy-EclipseBetter DSL Support for Groovy-Eclipse
Better DSL Support for Groovy-Eclipse
 
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

HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...ranjana rawat
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 

Último (20)

HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 

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 ?