Midsem 2 Important Questions
Midsem 2 Important Questions
Midsem 2 Important Questions
Q1. Using Floyd Warshall Algorithm solve the all pair shortest path problem for the
graph. Where weight matrix is given below :-
0 ∞ 3 ∞
2 0 ∞ ∞
∞ 7 0 1
6 ∞ ∞ 0
Q2. Solve the following 0/1 Knapsack Problem using Dynamic Programming .The
Capacity of Knapsack W is 10?
Item 1 2 3 4
Weight 4 7 5 3
Value 40 42 25 12
Q3. Find the shortest path from vertex 1 to vertex 5 in the following weighted graph
using Dijkstra’s greedy algorithm.
Q4. Find a minimum cost path from‘s’ to‘t’ in multistage graph using dynamic
programming using backward approach.
4
A D
1 18
11 9
2 5 13
S B E T
16 2
5
C 2
F
Q5. . Explain Multistage? Discuss its Application and reliability design with Example.
Q6.What is Backtracking? Find the solution to the 4-Queen problem using backtracking
strategy?
Q7. What do you understand by Hamiltonian cycles? Write an algorithm to find all
Hamiltonian cycles in a given graph using backtracking and determine the complexity
also.
Q8. Explain Graph Coloring problem with their complexity?
Q10. Consider the traveling salesperson instance defined by the cost matrix. Obtain the
reduced cost matrix and solve it
20 30 10 11
15 16 4 2
3 5 2 4
19 6 18 3
16 4 7 16
Q13. Discuss the relationship between class P,NP,NP-complete and NP-hard problems
with suitable example of each class?
Q14. Construct an AVL tree for the following list {5, 6, 8, 3, 2, 4, 7} by inserting the
elements successively, starting with empty tree.