please provide a detailed full solution to each mcq, thank you so much! 1. (7) C
ID: 3571450 • Letter: P
Question
please provide a detailed full solution to each mcq, thank you so much!
Explanation / Answer
a) TRUE
Explaination:
if n=5
then running time of O(n) time algorithm is 5
and running time of O(2n) time algorithm is 32 i.e. 25
hence, it is clear that O(n) time algorithm is faster than O(2n) time algorithm.
b) TRUE
Explanation:
In some system, rupees come in 1 rs , 7 rs , and 10 rs coins.
Using a greedy algorithm to count out 15 rupees , we would get a 10 rs coin and Five 1 rs coins for a total of 15 rs. This requires six coins
A better(optimal) solution would be to use two 7 rs coin and one 1 rs coin
This only requires three coin
So, we can say that Greedy algorithm do not always produce optimal solutions.
c) TRUE
Kruskal's minimum spanning tree algorithm works correctly with negative weights also because it adds up all weights along the paths and tries to find the minimum one.
d) FALSE
The Subset Sum problem is an NP complete problem, but it does not have a polynomial time algorithm. The algorithm takes O(np) time, where n is the input size, and p is the precision. If you look at it, it shall seem to be polynomial time, but in reality its not.
The reason is because its not polynomial with respect to the input size n. Its because P can take any large value, say 2^n. So np = n*(2^n), which is not polynomial.
e) TRUE
the VERTEX COVER problem admits a polynomial-time algorithm. Hence, NP-complete problem can be solved in polynomial time.
f) FALSE
there is no lenear time algorithm.
g) TRUE
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.