Question

In: Computer Science

Suppose you have algorithms with the five running times listed below. (Assume these are the exact...

Suppose you have algorithms with the five running times listed below.

(Assume these are the exact running times.)

How much slower (i.e., you need check the ratio) do each of these algorithms get when
you (a) double the input size, (b) increase the input size by one?

5nlog(n)

Solutions

Expert Solution

Required ratio = Performance of new time / performance of old time

We know that performance is inversely proportional to execution time

So, required ratio = execution time of old / execution time of new

a).Double the input size

Required ratio = old time / new Time = 5nlogn / (5*2nlog(2n))

= 5nlogn /10nlog2n

= logn / (2log2 + 2logn)

So, required slowdown or ratio in terms of n = logn/(2log2 + 2logn)

if we try to simply above then

ratio= 1/(2log2/logn + 2)

Suppose n tends to infinity then logn ->infinity so, log2 / logn = log2/infinity = 0

So, if n tends to infinity then ratio = 1/(0+ 2) = 0.5

b). Increase the input size by 1

Required slowdown or ratio = old time/new time

= 5(n+1)log(n+1)/5nlogn

= (n+1)log(n+1)/nlogn

So, required slowdown or ratio in terms of n = (n+1)log(n+1)/nlogn

Now , if we try to reduce above obtained ratio,we get

Ratio= (1+1/n)log(n(1+1/n))/logn

= (1+1/n)*(logn + log(1+1/n)) / logn

Suppose n tends to infinity then 1/n tends to 0

So, ratio = logn / logn = 1

So, if n is very large then by increasing input size by 1 the slowdown is almost negligible.


Related Solutions

Determine the running time of each of the algorithms below. For questions 2a. and 2b., you...
Determine the running time of each of the algorithms below. For questions 2a. and 2b., you may determine the running time line-by-line (see Lecture 2, slide No. 8). For questions 2c – 2f, you may determine the running time by focusing on the basic operation of the algorithm. a,sum = 0; for (i=1; i<=n; i++) sum += n; b. Algorithm maxVal (numbers, n) currentVal ← numbers [0] for i ← 1 to n − 1 do if numbers [i] >...
Listed below are time intervals​ (min) between eruptions of a geyser. Assume that the​ "recent" times...
Listed below are time intervals​ (min) between eruptions of a geyser. Assume that the​ "recent" times are within the past few​ years, the​ "past" times are from around 20 years​ ago, and that the two samples are independent simple random samples selected from normally distributed populations. Do not assume that the population standard deviations are equal. Does it appear that the mean time interval has​ changed? Is the conclusion affected by whether the significance level is 0.10 or 0.01​? Recent...
Listed below are time intervals​ (min) between eruptions of a geyser. Assume that the​ "recent" times...
Listed below are time intervals​ (min) between eruptions of a geyser. Assume that the​ "recent" times are within the past few​ years, the​ "past" times are from around 20 years​ ago, and that the two samples are independent simple random samples selected from normally distributed populations. Do not assume that the population standard deviations are equal. Does it appear that the mean time interval has​ changed? Is the conclusion affected by whether the significance level is 0.10 or 0.01​? Recent...
A.) Suppose that we run the exact same experiment 100 times and find a statistically significant...
A.) Suppose that we run the exact same experiment 100 times and find a statistically significant difference 30 times out of 100 using an alpha level of .05. What is the best estimate of our statistical power? a) a difference between means is very likely to be detected b) the significance level set by the researcher must be high c) the probability of type I error is very high d) Your study will likely be inconclusive B) A researcher believes...
A.) Suppose that we run the exact same experiment 100 times and find a statistically significant...
A.) Suppose that we run the exact same experiment 100 times and find a statistically significant difference 30 times out of 100 using an alpha level of .05. What is the best estimate of our statistical power? a) a difference between means is very likely to be detected b) the significance level set by the researcher must be high c) the probability of type I error is very high d) Your study will likely be inconclusive B) A researcher believes...
Suppose that you are a salesperson for one of the products or services listed below. Personal...
Suppose that you are a salesperson for one of the products or services listed below. Personal computers Carpet Financial planning Clothing Moving services Life insurance As a salesperson for your chosen product or service, suppose that you are about to talk to a prospect who has given you no indication of her needs relative to the product or service. Your task is to come up with questions that will tell you the customer's needs. To do so, you are expected...
Assume your sorting algorithms have to deal with lists that can potentially contain duplicates. Assume the...
Assume your sorting algorithms have to deal with lists that can potentially contain duplicates. Assume the same sorting algorithms as discussed in class / in the textbook. (a) What is the running time of Insertion Sort when all elements in a given list of length N are equal? Explain your answer. (b) Give a Θ-bound on the running time of Mergesort for the case that all elements in a given list of length N are equal (assuming N is a...
The values listed below are waiting times? (in minutes) of customers at two different banks. At...
The values listed below are waiting times? (in minutes) of customers at two different banks. At Bank? A, customers enter a single waiting line that feeds three teller windows. At Bank? B, customers may enter any one of three different lines that have formed at three teller windows. Answer the following questions. Bank A 6.36.3 6.66.6 6.76.7 6.86.8 7.17.1 7.37.3 7.47.4 7.87.8 7.87.8 7.87.8 Bank Upper BBank B 4.24.2 5.45.4 5.85.8 6.26.2 6.76.7 7.77.7 7.77.7 8.68.6 9.39.3 10.010.0 Construct aa...
The values listed below are waiting times​ (in minutes) of customers at two different banks. At...
The values listed below are waiting times​ (in minutes) of customers at two different banks. At Bank​ A, customers enter a single waiting line that feeds three teller windows. At Bank​ B, customers may enter any one of three different lines that have formed at three teller windows. Answer the following questions. Bank A 6.4 6.6 6.7 6.8 7.1 7.3 7.4 7.7 7.7 7.7 Bank B 4.1 5.3 5.9 6.2 6.8 7.6 7.6 8.4 9.4 10 Construct a 99​% confidence...
The values listed below are waiting times​ (in minutes) of customers at two different banks. At...
The values listed below are waiting times​ (in minutes) of customers at two different banks. At Bank​ A, customers enter a single waiting line that feeds three teller windows. At Bank​ B, customers may enter any one of three different lines that have formed at three teller windows. Answer the following questions. Bank A 6.46.4 6.66.6 6.76.7 6.86.8 7.17.1 7.27.2 7.57.5 7.87.8 7.87.8 7.87.8 Bank Upper BBank B 4.24.2 5.35.3 5.85.8 6.16.1 6.76.7 7.87.8 7.87.8 8.48.4 9.49.4 10.010.0 LOADING... Click...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT