Question

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 are insignificant, and state your answers in the form HH:MM:SS.S (hours, minutes, seconds, tenths of a second). Be sure to show supporting work.

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

Let's assume that the algorithm had complexity theta(N).

i.e time take for 1 element = 30/224 = 0.133992 seconds.

when we have 230 elements

a) when algorithm has theta(N) complexity the functions grows linearly

==> 230 * 0.133992 = 30.8035 seconds

==> 00:00:30.80

b) when algorithm has theta(log N) complexity functions grows logarithmic

==> log(230) * 0.133992 = 1.051 seconds

==> 00:00:1.05

c) when algorithm has theta (N log N) complexity functions grows linearithmic

==>log(230) * 230 * 0.133992 = 241.6685seconds

==> 00:04:1.6685

d) hen algorithm has theta (N ^ 2) complexity functions grows quadratic

==> 230 * 230 * 0.133992 = 7088.1768 seconds

==> 01:58:08.1768

Add a comment
Know the answer?
Add Answer to:
Suppose that an algorithm takes 30 seconds for an input of 224 elements (with some particular,...
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
  • You are running algorithm with squared complexity on data with 100 elements and it takes 10...

    You are running algorithm with squared complexity on data with 100 elements and it takes 10 seconds. How much time do you expect the algorithm will take when executed on data with 1000 elements? Order the following: O(n2), O(12 + 7n), O(n log(n) + 300 n2 + 1/125 n3)

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

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

  • What is the role of polymorphism? Question options: Polymorphism allows a programmer to manipulate objects that...

    What is the role of polymorphism? Question options: Polymorphism allows a programmer to manipulate objects that share a set of tasks, even though the tasks are executed in different ways. Polymorphism allows a programmer to use a subclass object in place of a superclass object. Polymorphism allows a subclass to override a superclass method by providing a completely new implementation. Polymorphism allows a subclass to extend a superclass method by performing the superclass task plus some additional work. Assume that...

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