DAA Group Assignment PDF
DAA Group Assignment PDF
1. Apply Dijkstra’s algorithm to find the shortest path from V1 to all other vertices
of the following directed graph by showing the necessary steps. (4 points)
V2 4
9 V5 6
4 V8 4
7
V1 V3 V6 V10
7
V9 5
V4 V7 5
1
2. Consider the following undirected weighted graph. Find the minimum
spanning tree (MST) and the cost of the MST using Prim’s algorithm. Draw
each step and consider node V1 as starting node. (3 points)
1 2
V1 V2 V3
6 6
4 4 6
3 8 V6
V4 V5
7
4 3
V7
2
3. Find the minimum spanning tree and its costs of the following undirected
weighted graph using Kruskal’s algorithm. (2 points)
C
A 7 8
5 B 7
9
E
D
8 9
6
F 11 G
3
4. Apply Floyd-Warshall’s algorithm to find the shortest paths between each
vertices in the following directed weighted graph. (4 points)
6
6
1
14
4
5. Finds the max possible items that can be carried in the knapsack to achieve maximum
Profit and find actual Knapsack Items using 0/1 Knapsack problem. Assume you have 5
number of items, the knapsack total weight is 6 and the Weight(wi) and benefit(bi) are as
shown in the following table. (3 points)