Question

STATEMENT 3: Algorithm A takes n log, (n) + 10na elementary operations and algorithm B takes 1776 + n log, n. Then for large

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

Statement 3:

In an equation, when n grows larger the lower order terms in the equation have the least effect on the running time of the algorithm.

Even a small fraction of the highest order term is enough to dominate the lower order terms when n is large enough. In general when we calculate algorithms running times we ignore the lower order terms and the coefficient of highest order term as they have a very minimal effect when n is large.

So from the given two equations if we ignore lower order terms and coefficient of the highest order term. So the equations we got

1)n5log3n (We ignored 10n2 as it is a lower order term) (Algorithm A)

2)n6 (We ignored 17 coefficient of n6 and lower order term  n4log7n) (Algorithm B)

We know that logn is faster than n.

We can write above two equations like below

1)n5 * log3n

2) n5 * n

So clearly the first equation i.e. n6 is greater than the second equation i.e. n5log3n and takes more time to run. Therefore Algorithm A is faster than Algorithm B

Add a comment
Know the answer?
Add Answer to:
STATEMENT 3: Algorithm A takes n log, (n) + 10na elementary operations and algorithm B takes...
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
  • Design an algorithm for the following description. Solution can be done in pseudo-code or steps of...

    Design an algorithm for the following description. Solution can be done in pseudo-code or steps of the algorithm. Describe and analyze an algorithm that takes an unsorted array A of n integers (in an unbounded range) and an integer k, and divides A into k equal-sized groups, such that the integers in the first group are lower than the integers in the second group, and the integers in the second group are lower than the integers in the third group,...

  • 1. (10 points) Write an efficient iterative (i.e., loop-based) function Fibonnaci(n) that returns the nth Fibonnaci...

    1. (10 points) Write an efficient iterative (i.e., loop-based) function Fibonnaci(n) that returns the nth Fibonnaci number. By definition Fibonnaci(0) is 1, Fibonnaci(1) is 1, Fibonnaci(2) is 2, Fibonnaci(3) is 3, Fibonnaci(4) is 5, and so on. Your function may only use a constant amount of memory (i.e. no auxiliary array). Argue that the running time of the function is Θ(n), i.e. the function is linear in n. 2. (10 points) Order the following functions by growth rate: N, \N,...

  • Need to find number of elementary expressions in terms of n, not looking for Big O...

    Need to find number of elementary expressions in terms of n, not looking for Big O complexity. 4. Work out the number of elementary operations in the worst possible case and the best possible case for the following algorithm (justify your answer): 0: function Nonsense (positive integer n) 1: it1 2: k + 2 while i<n do for j+ 1 to n do if j%5 = 0 then menin else while k <n do constant number C of elementary operations...

  • What does a run-time analysis usually countS pts a. The number of arithmetic and other operations...

    What does a run-time analysis usually countS pts a. The number of arithmetic and other operations required fot the b. The number of megabytes required for the program to run c. The number of seconds required for the program to run. d. The number of seconds plus the number of megabytes Total 100 points, 30 ins and other operations required for the program to rn 2. What do we call an input that results in the longest execution timet a....

  • Please answer ASAP Thank You 1Consider an algorithm that requires the following number of operations (time...

    Please answer ASAP Thank You 1Consider an algorithm that requires the following number of operations (time units) for these input sizes (n). The algorithm is ___________ . Input size Operations 100 100,000 400 100,000 1600 100,000 Group of answer choices 1.O(n2) 2.O(n) 3.O(log n) 4.O(n3) 5.O(1) 2The below algorithm contains nested loops. for (int total = 1; total <= n; total++) { for (int samples = 0; samples < n; samples++) { for (int location = 1; location < 10;...

  • Question 2 Consider the following algorithm Fun that takes array A and key Kas Fun(AO,...,n -...

    Question 2 Consider the following algorithm Fun that takes array A and key Kas Fun(AO,...,n - 1], K) count = 0 for i = 0 ton - 1 do for j = i +1 to n - 1 do if A[i] + A[j] == K then count = count +1 end if end for end for return count What is the best case time complexity of the above algorithm?! (log(n)) O(1) (n) (na) Previous o H H 9

  • 9. (5 points) Please describe an algorithm that takes as input a list of n integers...

    9. (5 points) Please describe an algorithm that takes as input a list of n integers and finds the number of negative integers in the list. 10. (5 points) Please devise an algorithm that finds all modes. (Recall that a list of integers is nondecreasing if each term of the list is at least as large as the preceding term.) 11. (5 points) Please find the least integer n such that f() is 0(3") for each of these functions f()...

  • 3) [16 points totall Consider the following algorithm: int SillyCalc (int n) { int i; int Num, answer; if (n &lt...

    3) [16 points totall Consider the following algorithm: int SillyCalc (int n) { int i; int Num, answer; if (n < 4) 10; return n+ else f SillyCalc(Ln/4) answer Num Num 10 for (i-2; i<=n-1; i++) Num + = answer + answer; answer return answer } Do a worst case analysis of this algorithm, counting additions only (but not loop counter additions) as the basic operation counted, and assuming that n is a power of 2, i.e. that n- 2*...

  • This BubbleSort algorithm takes as its input the list of "words" w), W2, ...,W.. Step 1:...

    This BubbleSort algorithm takes as its input the list of "words" w), W2, ...,W.. Step 1: Let j=1. Step 2: If j=n then output the list wi, W2, ...,Wn Step 3: Set k=n-1 Step 4: If wx+1 <wk, then swap the values of wk and wx+1 Step 5: If k>j, then replace k by k-1 and go to step 4. Step 6: Replace j by j +1 Step 7: Go to step 2 Find a function which gives the total...

  • (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)....

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