DAAT2
DAAT2
DAAT2
All programs can be stored on the tape iff the sum of the lengths of the programs is at
most L.
Assume the tape is initially positioned at the front. If the programs are stored in the order
I = i1, i2, , in, the time tj needed to retrieve program ij .
tj = lik ,1kj
If all programs are retrieved equally often, then the mean retrieval time (MRT)
=
This problem fits the ordering paradigm. Minimizing the MRT is equivalent to
minimizing
d(I) = lik,1kj,1jn
If there are m > 1 tapes, T0,T1,T2, .Tm-1 then programs are to be distributed
over these tapes.
If Ii is the storage permutation for the subset of programs on tape j, then total retrieval
time (TD) is d(Ij)
The objective is to store the programs in such away as to minimize TD.
1b) Find an optimal placement for 13 programs on three tapes T0, T1 and T2 where the
programs are of lengths 12 , 5 , 8 , 32 , 7 , 5 , 18 ,26 ,4, 3, 11, 10 and 6 and also analyze its
algorithm.
Algorithm Store(n, m)
// n is the number of programs and m the number of tapes
{
j : = 0; // next tape to store on
for i := 1 to n do
{
Write (append program, i , to permutation for tape, j);
j : = (j+1) mod m ;
}
}
2a)Explain the procedure for finding minimum cost spanning tree using kruskals method.
Kruskals Method
1) Start with a forest that has no edges.
2)Add the next minimum cost edge to the forest if it will not cause a cycle.
3)Continue this process until the tree has n - 1 edges.
2b)Construct a minimal spanning tree for the tree with the following graph using Kruskal's
algorithm
a) prims algorithm
a) Prims algorithm
b) Kruskals algorithm
4.Solve the following 0/1 knapsack instance using dynamic programming when n=5,
m=6,P={25,20,15,40,15} and W={3,2,1,4,5}.
5. Apply Dynamic Programming to solve all pairs shortest path problem with suitable example
6. Find shortest path from node 1 to every other node of fig using Bellman and Ford algorithm..