Ad3351 Set2
Ad3351 Set2
Ad3351 Set2
Third Semester
(Regulations 2021)
1. Create a program for recursive and non-recursive algorithms and examine the order of
growth from log2n to n!
2. Write a program using Divide and Conquer Strassen's Matrix Multiplication to multiply the
two square matrices A and B, each of size n x n.
⎡1 2 3⎤ ⎡2 2 3⎤
A= ⎢3 4 5⎥ B= ⎢1 4 5⎥
⎢ ⎥ ⎢ ⎥
⎢⎣5 4 3⎥⎦ ⎢⎣6 4 3⎥⎦
3. To solve the following topological sorting problem, develop a code based on the DFS
method. a e
b d f
c g
Page 1 of 5
4. Create a program to sort the following elements 4,8,2,7,19,22,3,5,9 in an ascending order
using Transform and Conquer Heap Sort method.
7. Create a program to find the transitive closure of the digraph specified in the following
graph using Warshall's algorithm.
a b
c d
8. Write a program to discover the transitive closure of the digraph specified in the following
adjacency matrix using Warshall's algorithm.
⎡0 1 1 0⎤
⎢0 0 1 0⎥⎥
⎢
⎢0 0 0 1⎥
⎢ ⎥
⎣1 0 0 0⎦
9. Write a program to find the shortest path between every pair of vertices of a graph using
Floyd’s Algorithm. 10
a e
5 3 9
12
b d 20
6
8
7 15
c g
Page 2 of 5
10. Create a program for the given instance of problem to obtain the optimal solution for the
knapsack problem using Dynamic Programming.
1 2 3
2 3 4
3 4 5
4 5 6
Capacity W=5
11. Write a program to solve the following knapsack instance using Dynamic Programming.
12. Create a program using Greedy Technique for finding a shortest path from one node to
another node in the following graph using Dijkstra’s algorithm.
G= [[0, 6, 0, 0, 0, 0, 0, 9, 0],
[0, 8, 0, 7, 0, 4, 0, 0, 2],
[0, 0, 0, 0, 0, 2, 0, 1, 6],
[0, 0, 2, 0, 0, 0, 6, 7, 0]]
Page 3 of 5
13. Create a program using Greedy Techniques to Construct the Huffman’s Tree & code for
the following data
Character A B C D E -
Probability 0.1 0.5 0.35 0.5 0.4 0.2
14. Write a program using Greedy Techniques to Construct the Huffman’s Tree & code for the
following data
Character m n o p q r
Probability 0.5 0.1 0.4 0.3 0.2 0.5
15. Create a program to solve the following Farmers problem using simplex method.
A farmer has a 420 acre farm on which she plants two crops: corn and soybeans. For
each acre of corn planted, her expenses are $60 and for each acre of soybeans planted,
her expenses are $110. Each acre of corn requires 110 quintals of storage and yields a
profit of $63; each acre of soybeans requires 40 quintals of storage and yields a profit of
$90. If the total amount of storage space available is 20,200 quintals and the farmer has
only $30,000 on hand, how many acres of each crop should she plant in order to
maximize her profit? What will her profit be if she follows this strategy?
17. There are 5 distinct numbers {1,2,5,6,8}. Find the combinations of these numbers such
that sum is 9. Write a code using backtracking method to arrive at the solution.
18. Create a program to find the optimal solution using Branch and Bound method for the
following assignment problem.
19. Write a program to find the optimal solution using Branch and Bound method for the
following assignment problem.
Page 4 of 5
20. Create a program to solve the following Travelling Salesman problem using Branch and
Bound method.
1
a b
3 8 5
7
c d
2
Page 5 of 5