Question

3. (20 points) Algorithm Analysis and Recurrence There is a mystery function called Mystery(n) and the pseudocode of the algo pleas answer asap
0 0
Add a comment Improve this question Transcribed image text
Answer #1

From the current pseudo code ,we get the recurrence relation as -T(n) = 9T(n/3) + n

Masters Theorem for dividing function is as :

T(n) = aT(n/b) + f(n)  where f(n) is of form nklogp(n)

Solution for these equation by masters theorem is as

  1. if a > bk, then T(n) = θ(nlogba)
  2. if a = bk, then
    (a) if p > -1, then T(n) = θ(nlogba logp+1n)
    (b) if p = -1, then T(n) = θ(nlogba loglogn)
    (c) if p < -1, then T(n) = θ(nlogba)
  3. if a < bk, then
    (a) if p >= 0, then T(n) = θ(nk logpn)
    (b) if p < 0, then T(n) = θ(nk)

Hence for the current code ,we get the soln as :O(n2)

Add a comment
Know the answer?
Add Answer to:
pleas answer asap 3. (20 points) Algorithm Analysis and Recurrence There is a mystery function called Mystery(n) and the pseudocode of the algorithm own as below. Assume that n 3* for some positiv...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT