Question

Consider two algorithms A1 and A2 that have the running times T1(n) and T2(n), respectively. T1(n)...

Consider two algorithms A1 and A2 that have the running times T1(n) and T2(n), respectively.

T1(n) = 5n2 + 3n and T2(n) = 500n.

  1. (12 points) Use the definition of Ω() to show that T1(n) Ω(T2(n))
  2. (3 points) Which algorithm should you use? A1 or A2? Justify

Homework Answers

Answer #1
Given
T1(n) = 5n2 + 3n and T2(n) = 500n.

(12 points) Use the definition of Ω() to show that T1(n) Ω(T2(n))
T1(n) = 5n2 + 3n
T2(n) = 500n
Definition of Big-Omega:
f(n) = Ω (g(n)) means there are positive constants c and k, such that 0 ≤ cg(n) ≤ f(n) for all n ≥ k
5n2 + 3n >= 500n
where c is 1 and n>0 and g(n) = 500n
So, from the definition of Big-Omega we can say that f(n) = Ω(g(n))
So, T1(n) = Ω(T2(n))

(3 points) Which algorithm should you use? A1 or A2? Justify
Time complexity of A1 is O(n^2)
Time complexity of A2 is O(n)
A1 is quadratic time where as A2 as linear.
A2 is better than A1.
So, we use A2 for the best.
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
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...
* Consider the transformations T1=‘reflection across the x-axis’ and T2=‘reflection across the line y = x’....
* Consider the transformations T1=‘reflection across the x-axis’ and T2=‘reflection across the line y = x’. (a) Find the matrices A1 and A2 corresponding to T1 and T2, respectively. (b) Show that (A1) 2 = I, and give a geometrical interpretation of this. (c) Use matrix multiplication to find the geometric effect of T1 followed by T2, showing all your reasoning. (d) The product T (θ)T (φ) of any two reflections T (θ) and T (φ) with angles θ and...
4. Suppose we have a classifier that classifies if an image contains a Human face or...
4. Suppose we have a classifier that classifies if an image contains a Human face or not. Suppose we have 100 images, 50 of which contain human faces. If our classifier accurately classifies that 30 images contains human faces, but at the same time wrongly classifies that 30 images contains human faces. What is the precision and recall. (10 points) 5. Suppose we use k-fold cross validation, how many times should we train the classifier? (10 points) 6. I have...
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...
Problem Definition: Problem: Given an array of integers find all pairs of integers, a and b,...
Problem Definition: Problem: Given an array of integers find all pairs of integers, a and b, where a – b is equal to a given number. For example, consider the following array and suppose we want to find all pairs of integers a and b where a – b = 3 A = [10, 4, 6, 16, 1, 6, 12, 13] Then your method should return the following pairs: 4, 1 15, 12 13, 10 A poor solution: There are...
Consider the C program (twoupdate) to demonstrate race condition. In this assignment, we will implement Peterson's...
Consider the C program (twoupdate) to demonstrate race condition. In this assignment, we will implement Peterson's algorithm to ensure mutual exclusion in the respective critical sections of the two processes, and thereby eliminate the race condition. In order to implement Peterson's Algorithm, the two processes should share a boolean array calledflagwith two components and an integer variable called turn, all initialized suitably. We will create and access these shared variables using UNIX system calls relating to shared memory – shmget,...
QUESTION 1 What does the following code segment output? int red, blue; red = 7; blue...
QUESTION 1 What does the following code segment output? int red, blue; red = 7; blue = red + 2 * 5 red++; blue = blue + red; cout << blue; 4 points    QUESTION 2 Is the following statement true or false? The Boolean expression in the following if statement will be true for all values of x in the range from 10 to 20 (including the endpoints) and false for all other values: int x; if (x >=...
What tools could AA leaders have used to increase their awareness of internal and external issues?...
What tools could AA leaders have used to increase their awareness of internal and external issues? ???ALASKA AIRLINES: NAVIGATING CHANGE In the autumn of 2007, Alaska Airlines executives adjourned at the end of a long and stressful day in the midst of a multi-day strategic planning session. Most headed outside to relax, unwind and enjoy a bonfire on the shore of Semiahmoo Spit, outside the meeting venue in Blaine, a seaport town in northwest Washington state. Meanwhile, several members of...
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...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how the firms resources incompetencies support the given pressures regarding costs and local responsiveness. Describe entry modes have they usually used, and whether they are appropriate for the given strategy. Any key issues in their global strategy? casestudy: Atlanta, June 17, 2014. Sea of Delta employees and their families swarmed between food trucks, amusement park booths, and entertainment venues that were scattered throughout what would...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT