Algorithms - Weekly Test 04 - Test Paper
Algorithms - Weekly Test 04 - Test Paper
Answer Key
1. (b) 6. (a)
2. (a) 7. (3 to 3)
3. (c) 8. (b)
4. (a) 9. (36 to 36)
5. (d) 10. (1950 to 1950)
4
1. (b) 7. (3 to 3)
S1(False): if there exist any negative weight edges,
then it may or may not work as expected.
S2(True): It is guaranteed to produce the MST even
there exists negative weight cycles.
2. (a)
Irrespective of the elements the time complexity of
merge sort is always O(nlogn)
3. (c)
If the graph is input by adjacency matrix then the T.C
is O(v2) as for each vertex we need to check if it is
connected to all other neighboring vertices.
∴ option (c) is correct.
4. (a) 8. (b)
As we can see that array is sorted, finding first, middle
for Job sequencing algorithm, time required to sort in
and last will take O(1) time and the selected pivot will
order get maximum profit is O(nlogn) find the max
divide the given array in two pards of n/2.
deadline = O(n)
n
For each slot ‘i’ apply linear search to find a job T ( n ) = 2T + O ( n )
containing deadline ≥ i = O (n2) 2
T(n) = O(nlogn) + O(n) + O(n2) = O(n2) = O (nlogn)
6. (a)
6 × 6 = 36
For more questions, kindly visit the library section: Link for web: https://smart.link/sdfez8ejd80if