SlideShare uma empresa 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 ?

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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 / ...
 

Destaque

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
 

Destaque (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
 

Semelhante 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
 

Semelhante 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 ...
 

Mais 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
 

Mais 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

UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesPrabhanshu Chaturvedi
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
(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
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 

Último (20)

UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
(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...
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 

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 ?