Question

For part (b), An algorithm takes 0.5 ms for input size 100. How large a problem...

For part (b),

An algorithm takes 0.5 ms for input size 100. How large a problem can be solved in 1 min if the running time is the following (assume low-order terms are negligible):

a. linear b. O(NlogN) c. quadratic d. cubic

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

(a) Linear:

We have,

Input Size (n) = 100

Time taken = 0.5 mS

⟹ problem size that can be solved in 1 mS = 100/0.5 = 200 problems

⟹ For Time = 1 min = 60 sec = 60 x 1000 mS = 60,000 mS

⟹ So, problem size that can be solved in 60,000 mS = 200 x 60,000

⟹ n = 12,000,000 problems

(b) O(n*log2(n)):

We have,

Input Size (n) = 100

Time taken = 0.5 mS

Which means, c * 100 log 100 = 0.5 mS

⟹ c = 0.5/100 log2 100 = 0.5/664 = 0.00075 ... (1)

Now, we need to find "n" from the equation below, for 1 min = 60 sec = 60 x 1000 mS = 60,000 mS

⟹ c * n log2(n) = 60000

But, c = 0.00075 ( from equation 1 )

⟹ 0.00075 * n log2(n) = 60000

⟹ n log2(n) = 60000 / 0.00075 = 80,000,000

⟹ n = 3.6685 x 106 problems

(c) Quadratic:

We have,

Input Size (n) = 100

Time taken = 0.5 mS

Using quadratic equation, we have,

⟹ c * 100 * 100 = 0.5

⟹ c = 5 x 10-5 ... (1)

Now, we need to find "n" from the equation below, for 1 min = 60 sec = 60 x 1000 mS = 60,000 mS

⟹ c x n2 = 60000

But, c = 5 x 10-5 ( from equation (1) )

⟹ n2 = 60000/5 x 10-5 = 1.2 x 109

⟹ n = 34641 problems

(d) Cubic

We have,

Input Size (n) = 100

Time taken = 0.5 mS

Using cubic equation, we have,

⟹ c * 100 * 100 * 100 = 0.5

⟹ c = 5 x 10-7 ... (1)

Now, we need to find "n" from the equation below, for 1 min = 60 sec = 60 x 1000 mS = 60,000 mS

⟹ c x n3 = 60000

But, c = 5 x 10-7 ( from equation (1) )

⟹ n3 = 60000/5 x 10-7 = 1.2 x 1011

⟹ n = 4932.42 problems

(Thank You!!)

Add a comment
Know the answer?
Add Answer to:
For part (b), An algorithm takes 0.5 ms for input size 100. How large a problem...
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
  • An algorithm takes 0.5 ms for input size of 100. How long will it take for...

    An algorithm takes 0.5 ms for input size of 100. How long will it take for an input of size of 500 assuming a big-O runtime of: a. O(? 2 ) b. O(? log10 ?)

  • 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,...

  • Suppose that an algorithm takes 30 seconds for an input of 224 elements (with some particular,...

    Suppose that an algorithm takes 30 seconds for an input of 224 elements (with some particular, but unspecified speed in instructions per second). Estimate how long the same algorithm, running on the same hardware, would take if the input contained 230 elements, and that the algorithm's complexity function is: Big theta not Big O a) Big theta(N) b) Big theta (log N) c) Big theta (N log N) d) Big theta(N^2) Assume that the low-order terms of the complexity functions...

  • Suppose the following is a divide-and-conquer algorithm for some problem. "Make the input of size n...

    Suppose the following is a divide-and-conquer algorithm for some problem. "Make the input of size n into 3 subproblems of sizes n/2 , n/4 , n/8 , respectively with O(n) time; Recursively call on these subproblems; and then combine the results in O(n) time. The recursive call returns when the problems become of size 1 and the time in this case is constant." (a) Let T(n) denote the worst-case running time of this approach on the problem of size n....

  • a. Use pseudocode to specify a brute-force algorithm that takes as input a list of n...

    a. Use pseudocode to specify a brute-force algorithm that takes as input a list of n positive integers and determines whether there are two distinct elements of the list that have as their sum a third element of the list. That is, whether there exists i, j.k such that iヂj, i关k,j关k and ai + aj = ak. The algorithm should loop through all triples of elements of the list checking whether the sum of the first two is the third...

  • I already solved part A and I just need help with part B 1. Matrix Multiplication...

    I already solved part A and I just need help with part B 1. Matrix Multiplication The product of two n xn matrices X and Y is a third n x n matrix 2 = XY, with entries 2 - 21; = xixYk x k=1 There are n’ entries to compute, each one at a cost of O(n). The formula implies an algorithm with O(nº) running time. For a long time this was widely believed to be the best running...

  • For [Select], there are three choices: worse than, the same as, better than Answer the following...

    For [Select], there are three choices: worse than, the same as, better than Answer the following questions about the computational properties of divide-and-conquer sorting algorithms, based on tight big-Oh characterizations of the asymptotic growth rate of the functions for the running time or space size, depending on the question. Assume that the input sequence is given as a list, and the output sequence is also a list. Also assume a general implementation of the sorting algorithms, as opposed to an...

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

  • C++ please read all the question Create 3 large arrays to search, where the size will...

    C++ please read all the question Create 3 large arrays to search, where the size will be variable up until it reaches your machines limit. They should contain the same information since we are going to compare 3 different algorithms.You are going to do operational studies on them to determine their order. O(N), O(log(N)), and O(1)? Search algorithms.Linear, Binary, Hash You should know which algorithms are what order,now you are going to prove it. Fill the 3 arrays with the...

  • Let T(n) denote the worst case running time of an algorithm when its input has size...

    Let T(n) denote the worst case running time of an algorithm when its input has size n. In divide and conquer algorithms, T(n) is often expressed using a recursion. Hence, expressing T(n) in terms of the big-Oh notation requires a bit of work. There are many ways of determining the growth rate of T(n). In class, I’ve shown you how to do it by drawing the recursion tree. Here are the steps: (1) draw the recursion tree out, (2) determine...

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