Question

1. Suppose you are given 3 algorithms A1, A2 and A3 solving the same problem. You know that in the worst case the running tim

0 0
Add a comment Improve this question Transcribed image text
Answer #1

(a) A3 is fastest for very large inputs as the complexity is logarithmic and polynomial only in second degree. So if we consider n=300,

T1(300)=2.7e+21

T2(300)=3e+302

T3(300)=2.229e+16

Thus, as T3(300) is least, therefore, A3 is fastest and as T2(300) is largest, therefore, time taken is most and A2 is slowest for large inputs.

(b) A1 is best for input size n>10 and n<100.

A2 is best for input size n<=10.

A3 is best for input size n>=100 and.

Add a comment
Know the answer?
Add Answer to:
1. Suppose you are given 3 algorithms A1, A2 and A3 solving the same problem. You...
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
  • Suppose we have two algorithms A1 and A2 for solving the same problem. Let T_1(n) be...

    Suppose we have two algorithms A1 and A2 for solving the same problem. Let T_1(n) be the worst case time complexity of Algorithm A1 and T_2(n) be the worst case time complexity of Algorithm A2. We know that T_1(1) = 1 and T_1(n) = 8 middot T_1(n/2) + 100n^2. We also know that T_2(1) = 1 and T_2(n) = 63 middot T_2(n/4) + 200 middot n^2. Use the master method to decide T_1(n). Follow all the steps as illustrated in...

  • Suppose that we have two algorithms A1 and A2 for solving the same problem. Let T1(n)...

    Suppose that we have two algorithms A1 and A2 for solving the same problem. Let T1(n) be the worst-case time complexity of A1 and T2(n) be the worst-case time complexity of A2. We know that: T(1)=1 T1(n)=15*T1(n/2)+n^2, n>1 T2(1)=1 T2(n)=80*T2(n/3)+20n^3,n>1 a. Use the master method to decide T1(n) b. Use the master method to decide T2(n) c. Which algorithms is more efficient? Why?

  • Assume you have the choice of two algorithms for the same problem, (a) One that reduces a problem...

    algorithms Assume you have the choice of two algorithms for the same problem, (a) One that reduces a problem of size n in O(n) time to two sub-problems of size in, or (b ) One that solves the problem without any recursion in time O(n2) Which algorithm is faster? Show that if f(n) f(½n) + O(log(n)), then f(n) = O((log n) 4. Write code for a function that takes a nonempty search tree of the form discussed in the class,...

  • Analysis of Algorithms Fall 2013 Do any (4) out of the following (5) problems 1. Assume n-3t is a...

    Analysis of Algorithms Fall 2013 Do any (4) out of the following (5) problems 1. Assume n-3t is a power of 3 fork20. Solve accurately the following recursion. If you cannot find the exact solution, use the big-O notation. Tu) T(n)Tin/3)+2 2. Suppose that you have 2 differeut algorithms to solve a giveu probleen Algorithm A has worst-case time complexity e(n2) and Algorithm B has worst-case time complexity e(nlog n). Which of the following statements are true and which are...

  • 1. What is the worst case time complexity of insertion into a binary search tree with...

    1. What is the worst case time complexity of insertion into a binary search tree with n elements? You should use the most accurate asymptotic notation for your answer. 2. A binary search tree is given in the following. Draw the resulting binary search tree (to the right of the given tree) after deleting the node with key value 8. 10 3. You have a sorted array B with n elements, where n is very large. Array C is obtained...

  • Question 4 (10 marks) When analysing the complexity of algorithms, there are three main approaches: worst case, best ca...

    Question 4 (10 marks) When analysing the complexity of algorithms, there are three main approaches: worst case, best case and average case. As an example, consider measuring the complexity of list-merging by counting the number of comparisons used As a test example, assume the following A1: There are two ordered lists, each of length 4, say A2: Neither list contains repeats, so a! < a2 < аз < a4 and bl <b2 < b3 < b4 A3: The lists are...

  • Suppose you are given an array of n integers a1, a2, ..., an. You need to...

    Suppose you are given an array of n integers a1, a2, ..., an. You need to find out the length of its longest sub-array (not necessarily contiguous) such that all elements in the sub-array are sorted in non-decreasing order. For example, the length of longest sub-array for {5, 10, 9, 13, 12, 25, 19, 70} is 6 and one such sub-array is {5, 10, 13, 19, 70}. Note you may have multiple solutions for this case. Use dynamic programming to...

  • (1) Give a formula for SUM{i} [i changes from i=a to i=n], where a is an...

    (1) Give a formula for SUM{i} [i changes from i=a to i=n], where a is an integer between 1 and n. (2) Suppose Algorithm-1 does f(n) = n**2 + 4n steps in the worst case, and Algorithm-2 does g(n) = 29n + 3 steps in the worst case, for inputs of size n. For what input sizes is Algorithm-1 faster than Algorithm-2 (in the worst case)? (3) Prove or disprove: SUM{i**2} [where i changes from i=1 to i=n] ϵ tetha(n**2)....

  • 5) (10 pts) Greedy Algorithms The 0-1 Knapsack problem is as follows: you are given a...

    5) (10 pts) Greedy Algorithms The 0-1 Knapsack problem is as follows: you are given a list of items, each item has an integer weight and integer value. The goal of the problem is to choose a subset of the items which have a sum of weights less than or equal to a given W with a maximal sum of values. For example, if we had the following five items (each in the form (weight, value)): 11(6, 13), 2(4, 10),...

  • Could I grab some help on problem 2? Thank you 2. Suppose Yi, Yn are iid...

    Could I grab some help on problem 2? Thank you 2. Suppose Yi, Yn are iid normal random variables with normal distribution with unknown mean and variance, μ and ơ2. Let Y ni Y. For this problem you may not assume that n is large. n (a) What is the distribution of Y? (b) What is the distribution of Z = (yo)' + ( μ)' + (⅓ュ)? (o) What is the distribution of ta yis (d) What is the distribution...

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