You are on page 1of 3

Assignment (DAA)

Last Date of Submission- 16/04/2024

1. Assume we have a knapsack with max weight capacity, W=15. We aim to fill the knapsack with
items such that the benefit (value or profit) is maximum. Solve using greedy methodology with
the algorithm?

2. Use dynamic programming mechanism for finding an optimal order of multiplying 4 matrices A1,
A2, A3, A4 and their dimensions 20, 25, 15, 10, 10.
3. What is the solution generated by Job Sequencing with deadlines with the following profits and
deadlines of jobs using the greedy methodology?

4. You have to make deliveries to all the places (vertices) marked in the map, starting from your
company's warehouse in vertex ‘0’. The numbers beside the roads tell you the distances between
the places. Your task is to find the shortest route to all the drop-off points. Can you find the best
route to deliver to every place? Use Prims Algorithm.

5. The diagram below shows roads connecting towns A,B,C,D,E,F,G and H. The numbers on each arc
represent the time, in minutes, required to travel along each road. Peter is delivering books from
his base at A to H. Use Dijkstra’s algorithm to find the minimum time for Peter’s journey.
6. We have a knapsack that can hold int w = 10 weight units. We have a total of int n =
4 items to choose from, whose values are represented by an array int[ ] val = {10, 40, 30,
50} and weights represented by an array int[ ] wt = {5, 4, 6, 3}. Solve the knapsack problem
using dynamic programming with the tabulation method.

7. Use Simplex Method to solve the following problem.

8. In the flow network illustrated below, each directed edge is labelled with its capacity. We are
using the Ford-Fulkerson algorithm to find the maximum flow. The first augmenting path is S-A-
C-D-T, and the second augmenting path is S-A-B-C-D-T. Draw the residual network after we
have updated the flow using these two augmenting paths (in the order given).

9. `Determine the cost and structure of the optimal binary search tree for a set K=(K1,K2,K3,
K4) keys. Pi is the probability of searching values in K and Qi is the probability of
searching values not in K.
0 1 2 3 4

Pi 0.2 0.2 0.1 0.1

Qi 0.1 0.1 0.05 0.05 0.1

10. Solve the 8-Qneen problem and draw the state space tree for the same.

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

You might also like