Question

a) Suppose that a particular algorithm has time complexity T(n) = 3 x 2^n, and that...

a) Suppose that a particular algorithm has time complexity T(n) = 3 x 2^n, and that executing an implementation of it on a particular machine takes t seconds for n inputs. Now suppose that we are presented with a machine that is 64 times as fast. How many inputs could we process on the new machine in t seconds?

b) Suppose that another algorithm has time complexity T(n) = n^2, and that executing an implementation of it on a particular machine takes t seconds for n inputs. Now suppose that we are presented with a machine that is 64 times as fast. How many inputs could we process on the new machine in t seconds?

c) A third algorithm has time complexity T(n) = 8n. Executing an implementation of it on a particular machine takes t seconds for n inputs. Given a new machine that is 64 times as fast, how many inputs could we process on the new machine in t seconds?

Homework Answers

Answer #1

The key to working these problems is observing that the runtime T tells you roughly the
number of instructions executed. For example, suppose T = 1000 seconds and the old machine
will execute 106 instructions/second. Then in T seconds, the old machine will execute 106 ×103 = 109
instructions, and the new machine will execute 64 × 109 instructions. Thus, in
any given period of time the new machine will do 64 times as much work as the old machine.
Hence, if Told(n) is the runtime of a program on the old machine, its runtime will be

Tnew(n) = 1/64*Told(n)
  
A). We have Tnew(n) = 3 · 2n, and Told(n0) = T. We want to know for what value of n = n1
will we have Tnew(n1) = T. Using our formulas, we have
3 · 2n0 =1/64*3 · 2n1
.
So
64 · 2n0 = 2n1
,
and since 64 = 26
, we have
26+n0 = 2n1
.
Thus, n1 = 6 + n0. If, for example, we could previously solve a problem of size 100, we
can now solve a problem of size 106.

B).  Using reasoning similar to that in part (a),

we have n02 = 1/64 *n12 . So n02 =n12 , and 8n0 = n1. So we can

solve a problem 8 times larger on the new machine.

C). ) Reasoning as in part (a) again, we have 8n0 = 1/64 *8n1, and 64n0 = n1.

So we can solve a problem 64 times larger on the new machine.

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
Suppose you implemented a quadratic time (that is an O(n^2) algorithm for a problem P. On...
Suppose you implemented a quadratic time (that is an O(n^2) algorithm for a problem P. On a test run, your algorithm takes 50 seconds on inputs of size 1000. Your friend found a clever algorithm which solves the same problem with a running time O(n^(3/2)). However, the faster algorithm takes 150 seconds on inputs of size 1000. How could this be? If you need to solve a problem of size 4000, which algorithm you should use? What about inputs of...
An algorithm has a running time like the following: T(n) = T(n-1) + an + b;...
An algorithm has a running time like the following: T(n) = T(n-1) + an + b; for n> 0 and a, b: the constant T(0) = 0 Determine the complexity of T(n)
How to measure the time complexity of an algorithm? Identify an important operation in the algorithm...
How to measure the time complexity of an algorithm? Identify an important operation in the algorithm that is executed most frequently. Express the number of times it is executed as a function of N. Convert this expression into the Big-O notation. A. For each of the three fragments of code, what is its worst-case time complexity, in the form "O(…)". (Use the given solution to the first problem as a model)                 //----------------- This is a sample problem – solved ------...
   1)T(n) = 27 T (n/3) + n3 2)Calculate the running time for the following code...
   1)T(n) = 27 T (n/3) + n3 2)Calculate the running time for the following code fragment. Algorithm test int counter, i, j; counter := 0; for (i:= 1; i < n; i*=2) { for (j:= 0; j < i; j++) { counter := counter +1 } } 3)Let f(n) = 2lg 8n + 3 be a function.
An exponential algorithm requires 4^n (four to the power n) steps to solve a problem with...
An exponential algorithm requires 4^n (four to the power n) steps to solve a problem with an input of size n. Suppose it has been found that using today's computer, a direct implementation of that algorithm would be able to handle an input size of 30 in 10 years. If the computer is speeded up by a factor of 100 (with no other changes), what input size can be processed in the same time? Explain your answer. (Hint: speeding up...
1. Given an n-element array A, Algorithm X executes an O(n)-time computation for each even number...
1. Given an n-element array A, Algorithm X executes an O(n)-time computation for each even number in A and an O(log n)-time computation for each odd number in A. What is the best-case running time of Algorithm X? What is the worst-case running time of Algorithm X? 2. Given an array, A, of n integers, give an O(n)-time algorithm that finds the longest subarray of A such that all the numbers in that subarray are in sorted order. Your algorithm...
Describe an algorithm that, given a list of n numbers, decides in linear time whether the...
Describe an algorithm that, given a list of n numbers, decides in linear time whether the list contains at least ⌈n/2⌉ numbers, all with equal value. What if we want to know if there are at least ⌈ n/100 ⌉ numbers with equal value? Hint: suppose some number, x, occurs ⌈n/2⌉ times. Where could all of these copies end up if we sorted? (This is not a suggestion we should actually sort). Wherever they end up, find one invariant.
discrete structures problems 1. A program P takes time proportional to logn where n is the...
discrete structures problems 1. A program P takes time proportional to logn where n is the input size. If the program takes 1 minute to process input of size 1,000,000, how many seconds does it take to process input of size 100? 2. When the best possible algorithm to solve a problem is exponential-time, or in general in nonpolynomial (not in O(np) for any p) we call such a problem ___________________. 3. f(x) is O(x 2) and g(x) is O(x...
1. For a particular operation, the setup time is 10 minutes and the run time is...
1. For a particular operation, the setup time is 10 minutes and the run time is 50 minutes to produce a standard lot of 40 parts. It takes three additional hours to circulate a container of parts after production is completed. The demand rate is 20,000 parts per month. There are 160 production hours in a month. a. How many standard containers are needed? n = D(T) / C Use the following inputs: Demand rate (D) = ________ parts /...
Suppose 50 people come to a fast food take-out restaurant each hour. There are four employees,...
Suppose 50 people come to a fast food take-out restaurant each hour. There are four employees, one at the register, two making the food, and one packaging the food. Suppose on average, each order takes 30 seconds at the register, and it takes one employee an average of 1.5 minutes to make the food, and it takes 1 minute on average to package the food. Assume exponential arrivals and service times. 1) How many people typically are waiting in line...