Question: The Mandrill and Baboon are two (fictitious) problems that accept a weighted graph and return an integer. Consider the reduction below, which reduces the

The Mandrill and Baboon are two (fictitious) problems that accept a weighted

 

The Mandrill and Baboon are two (fictitious) problems that accept a weighted graph and return an integer. Consider the reduction below, which reduces the Mandrill problem to the Baboon problem. Input: G= (V,E): weighted graph with n vertices and m edges Input: n, m: order and size of G Output: Mandrill(G) 1 Algorithm: Monkey Business 2 H = Graph(n); 3 for u V do 4 5 6 7 for v V do if G.isAdjacent (u, v) then Let w be the weight of (u, v); if w 100 then 8 9 10 11 12 end 13 end 14 end |H.addEdge(u, v, 5 + w/20); else if w 25 then |H.addEdge(u, v, w); end 15 return Baboon(H); 1. What is the worst-case time complexity of this reduction, not including the cost to compute Baboon(H)? You may assume that the square root in line 10 takes (1) time to compute, and assume that we use an adjacency matrix to represent the graphs G and H. 2. Suppose that we know that the complexity for Baboon is bounded above by O(B(m, n)) and below by (b(m, n)) for a graph with m edges and n vertices. What does the algorithm above prove about the complexity of Mandrill, assuming that B(m, n) and b(m, n) are both larger than your answer to question 1? Justify your answer.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!