DAA Assignment questions (1)
DAA Assignment questions (1)
9. Design floyd’s algorithm to find shortest distance from all nodes to all other nodes.
10. Apply Warshell’s algorithm to compute transitive closure for the graph given below.
(repeat)
13. Design an algorithm to find all pairs of shortest paths given a weighted connected path
using dynamic programming technique. Apply the same algorithm to compute all pairs of
shortest path for the following weighted connected graph.
14. Design an algorithm to solve knapsack problem using dynamic programming. Apply the
same to solve the following knapsack problem where W = 50.
Items weight Value
1 10 60
2 20 100
3 30 120
15. Define transitive closure of a directed graph. Write Warshall's algorithm to find transitive
closure. Apply the same find the transitive closure of the digraph given below.
16. Define a multistage graph. Give an example. Explain the technique of finding the
minimum cost path in a multistage graph.
17. Define transitive closure of a directed graph. Find the transitive closure matrix for the
graph whose adjacency matrix is given below.
1 0 0 1 0
0 1 0 0 0
[0 0 0 1 1]
1 0 0 0 0
0 1 0 0 1
18. Apply dynamic programming method to solve the following instance of the knapsack
problem knapsack capacity w=10.
Items weight value
1 6 42
2 4 15
3 2 20
4 5 30
19.Apply flody’s algorithm to the graph given below .show that all necessary steps derive its
time efficiency.
MODULE 5
1. Solve the given instance of sum of subset problem s={3,5,6,7} and d=15. Construct a
state space tree.
2. With the help of a state space tree. Solve the Travelling Salesman Problem for the
following graph using branch and bound concept.
graph below.
10. Apply best first Branch and bound algorithm to solve the instance of the given job
assignment problem.(repeat)
JOB1 JOB2 JOB3 JOB4
A 9 2 7 8
B 6 4 3 7
C 5 8 1 8
D 7 6 9 4
11. Apply Back Tracking method to solve sum of subset problem for the instance d = 30 S
={5, 10, 12, 13, 15, 18} Give all possible solution with state space for construction.
12. Apply Branch and bound method for knapsack problem. C=10(repeat)
Items 1 2 3 4
Weights 4 7 5 3
values $40 $42 $25 $12
13. Write short note on the following:
i. P
ii. NP
iii. NP-complete
iv. NP-hard class problems
14. What isbacktracking? List out two advantages of backtracking strategy. Considering 4-
Queens problem,provide two possible solutions to this problem using backtracking
technique.
15. Find the Hamiltonian circuit for the following graph using backtracking technique.