Question

1. Suppose you are given 3 algorithms A1, A2 and A3 solving the same problem. You...

1. Suppose you are given 3 algorithms A1, A2 and A3 solving the same problem. You know that in the worst case the running times are T1(n) = (10^4)n, T2(n) = 10n , T3(n) = (10^3)(n^3) log10 n (a) Which algorithm is the fastest for very large inputs? Which algorithm is the slowest for very large inputs? (Justify your answer.) (b) For which problem sizes is A1 the best algorithm to use (out of the three)? Answer the same question for A2 and then for A3. (Justify your answer.)

Homework Answers

Answer #1

T1(n) = (10^4)n, T2(n) = 10n , T3(n) = (10^3)(n^3) log10 n


A)

Which algorithm is the fastest for very large inputs?
A1 is fastest for large Input, because T1 takes linear time to solve the problem
A2 is slowest for large input , Its because growth rate of exponential is much higher than that of polynomial.

B)

A1 is better for values greater than 4 since the grown for A1 is linear

A2 is better for values less than equal to 4 and greater than equal to 1 , since T2 = 104 and T1 = 4*10^4

A3 is better only for value n = 0 since log10 1 is 0 and T2(1) = 1 AND T3 = 0



Thanks, PLEASE COMMENT if there is any concern.

Know the answer?
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
Similar Questions
Suppose you are given a set S = {a1,a2,···,an} of tasks, where task ai requires pi...
Suppose you are given a set S = {a1,a2,···,an} of tasks, where task ai requires pi units of processing time to complete, once it has started. You have one computer on which to run these tasks, and the computer can run only one task at a time. Let ci be the completion time of task ai, that is, the time at which task ai completes processing. Your goal is to minimize the average completion time, that is, to minimize n1...
Find a general term (as a function of the variable n) for the sequence{?1,?2,?3,?4,…}={45,1625,64125,256625,…}{a1,a2,a3,a4,…}={45,1625,64125,256625,…}. Find a...
Find a general term (as a function of the variable n) for the sequence{?1,?2,?3,?4,…}={45,1625,64125,256625,…}{a1,a2,a3,a4,…}={45,1625,64125,256625,…}. Find a general term (as a function of the variable n) for the sequence {?1,?2,?3,?4,…}={4/5,16/25,64/125,256/625,…} an= Determine whether the sequence is divergent or convergent. If it is convergent, evaluate its limit. (If it diverges to infinity, state your answer as inf . If it diverges to negative infinity, state your answer as -inf . If it diverges without being infinity or negative infinity, state your answer...
USING PYTHON do all the he problems using while loop , continue and break 1-This problem...
USING PYTHON do all the he problems using while loop , continue and break 1-This problem provides practice using a while True loop.write a function named twoWords that gets and returns two words from a user. The first word is of a specified length, and the second word begins with a specified letter.The function twoWords takes two parameters: an integer, length, that is the length of the first word and a character, firstLetter, that is the first letter of the...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary rivals? How will the acquisition of Reebok by Adidas impact the structure of the athletic shoe industry? Is this likely to be favorable or unfavorable for New Balance? 2- What issues does New Balance management need to address? 3-What recommendations would you make to New Balance Management? What does New Balance need to do to continue to be successful? Should management continue to invest...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT