Question
Discrete Math

6. Give a big-Theta estimate for the number of additions in the following algorithm. procedure foo (n: integer) bar 0; for i 1 to n for j 1 to m bar bar titj return bar b)Consider the procedure Tgiven below. procedure T (n: positive integer) if n 1 return 2 for i 1 to n x x x x return T(%)+T(%) Let (n) be the number of additions in the procedure for an input of n and note that f (n) satisfies a recurrence relation of the form f(n) af(n/b)+cn ii Apply The Master Theorem (given below) to T to determine its complexity. Master Theorem Given f(n) af(n/b) +cn then if a <b fon) is o(n log n) if a b
0 0
Add a comment Improve this question Transcribed image text
Answer #1

a.) Since both loops are running independently from each other, therefore time complexity of nested loop can be given as the product of time complexity associated with each for loop. i.e,

t(n) = theta(n^3 * n^2) = theta(n^5)

b.) Recurrence relation is given as:

t(n) = 3t(n/4) + n^3

i.) which gives

a = 3, b = 4, c = 1 and d = 3

ii.) since, a < b^d, therefore

t(n) = theta(n^d) = theta (n^3)

Hope it helps, feel free to comment in case of any query.

Add a comment
Know the answer?
Add Answer to:
Discrete Math Give a big-Theta estimate for the number of additions in the following algorithm a)...
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