Algorithm

Getting Started with AlgorithmWhat is an Algorithm?

Characteristics of Algorithm1 Topic

Analysis Framework

Performance Analysis3 Topics

Mathematical Analysis2 Topics

Sorting AlgorithmSorting Algorithm10 Topics

Searching Algorithm6 Topics

Fundamental of Data StructuresStacks

Queues

Graphs

Trees

Sets

Dictionaries

Divide and ConquerGeneral Method

Binary Search

Recurrence Equation for Divide and Conquer

Finding the Maximum and Minimum

Merge Sort

Quick Sort

Stassen’s Matrix Multiplication

Advantages and Disadvantages of Divide and Conquer

Decrease and ConquerInsertion Sort

Topological Sort

Greedy MethodGeneral Method

Coin Change Problem

Knapsack Problem

Job Sequencing with Deadlines

Minimum Cost Spanning Trees2 Topics

Single Source Shortest Paths1 Topic

Optimal Tree Problem1 Topic

Transform and Conquer Approach1 Topic

Dynamic ProgrammingGeneral Method with Examples

Multistage Graphs

Transitive Closure1 Topic

All Pairs Shortest Paths6 Topics

BacktrackingGeneral Method

NQueens Problem

Sum of Subsets problem

Graph Coloring

Hamiltonian Cycles

Branch and Bound2 Topics

0/1 Knapsack problem2 Topics

NPComplete and NPHard Problems1 Topic
Participants2253
All Pairs Shortest Paths
 In all pair shortest path, when a weighted graph is represented by its weight matrix W then objective is to find the distance between every pair of nodes.
 We will apply dynamic programming to solve the all pairs shortest path.
 In all pair shortest path algorithm, we first decomposed the given problem into sub problems.
 In this principle of optimally is used for solving the problem.
 It means any sub path of shortest path is a shortest path between the end nodes.
Steps:
i. Let A^k i,j be the length of shortest path from node i to node j such that the label for every intermediate node will be ≤ k.
ii. Now, divide the path from i node to j node for every intermediate node, say ‘k’ then there arises two case.
a. Path going from i to j via k.
b. Path which is not going via k.
iii. Select only shortest path from two cases.
iv. Using recursive method we compute shortest path.
v. Initially:
vi. Next computations:
Algorithm:
Analysis of Algorithm:
i. The first double for loop takes O (n2) time.
ii. The nested three for loop takes O (n3) time.
iii. Thus, the whole algorithm takes O (n3) time.
Example: Compute all pair shortest path for following figure 1.
Solution:
Thus the shortest distances between all pair are obtained.