Question

Suppose the runtime of a computer program is proportional to n(logn)2. For input size 28 the...

Suppose the runtime of a computer program is proportional to n(logn)2. For input size 28 the runtime is 154 ms. What is the new runtime in ms when the input size is squared? (Type just the number, not "ms")

Homework Answers

Answer #1

Solution:

Given,

=>Runtime is proportional to n(logn)^2

=>When n = 28, runtime = 154 ms

The answer will be "17,248"

Explanation:

=>Let say runtime = t

=>t n(logn)^2

=>t = c*n(logn)^2 where c is proportionality constant.

Finding value of c:

=>We know that when n = 28 , t = 154

Put n = 28 and t = 154

=>154 = c*28*(log28)^2

Assuming base of log 10(by default)

=>c = 154/(28*(log28)^2)

Now finding runtime(t) when n = (28)^2:

=>t = c*(28)^2*(log(28)^2)^2

=>t = {154/(28*(log28)^2)}*(28)^2*(2log(28))^2 using log property

=>t = {154/(28*(log28)^2)}*(28)^2*4*(log28)^2

Cancelling (log28)^2 and 28 from numerator and denominator

=>t = 154*28*4 ms

=>t = 17,248 ms

I have explained each and every part with the help of statements attached to the answer above.

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 the runtime of a computer program is proportional to the fourth root of the input...
Suppose the runtime of a computer program is proportional to the fourth root of the input size. If the original runtime is 165 ms and the input size is multiplied by 8,598 what is the new runtime in ms? (Just type the number not "ms"). Round your answer to the nearest whole number.
A program has runtime proportional to (log n)7 where n is the input size. Suppose we...
A program has runtime proportional to (log n)7 where n is the input size. Suppose we run the program with input size 10 and the runtime is 35 ms. What will the new  runtime be in seconds when we increase the input size to ten billion?.
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...
A program takes time T(n) = k2n  where k is some constant and n is the input...
A program takes time T(n) = k2n  where k is some constant and n is the input size. The program is run twice on the same computer (so k is the same in both cases). The first run is with n = 4 and the time taken is 20 ms. The second run is with n = 10. What is the time taken for the second run, in milliseconds? (Type in just the number; don't type "ms" at the end.)
2.) Consider an input array A of size n in which n − 1 of the...
2.) Consider an input array A of size n in which n − 1 of the elements have identical values and the remaining one value is smaller than the n − 1 identical values. What is the running time of Heapsort with input A?
Write a C program that prompts the user to input as many unsigned(n) as the user...
Write a C program that prompts the user to input as many unsigned(n) as the user wants to type, terminated by non negative number You may assume without checking that when the user is supposed to type an unsigned, he nevertypes a double You may assume without checking that when the user is supposed to type an unsigned, he nevertypes a negative number. For each number the user types, output whether that number is prime or not. You won't need...
Write a Python program to ask user input of a string, then ask user input of...
Write a Python program to ask user input of a string, then ask user input of what letters they want to remove from the string. User can either put in "odd", "even" or a number "n" that is greater than 2. When user input "odd", it will remove the characters which have odd numbers in the sequence of the string. When user input "even", it will remove the characters which have even numbers in the sequence of the string. When...
Do the flowchart of that program name = input('Enter the name: ','s'); n=input('\n Enter number of...
Do the flowchart of that program name = input('Enter the name: ','s'); n=input('\n Enter number of rented cars: '); m=input('\n Enter car type \n1:SEDAN 2:SUV '); nm = input('\n Enter number of miles travelled: '); d = input('\n Enter number of days: '); if m==1 if (1<=d)&&(d<=6)&&nm<=80 tpay_sed = 79*n*d; elseif (1<=d)&&(d<=6)&&nm>80 em=nm-80; tpay_sed = 79*n*d + 0.69*em*n; end if (7<=d)&&(d<=29)&&nm<=100 tpay_sed = 69*n*d; elseif (7<=d)&&(d<=29)&&nm>100 em=n-100; tpay_sed = 69*n*d + 0.59*em*n; end if (30<=d)&&nm<=120 tpay_sed = 59*n*d; elseif (30<=d)&&nm>120...
Program Behavior Each time your program is run, it will prompt the user to enter the...
Program Behavior Each time your program is run, it will prompt the user to enter the name of an input file to analyze. It will then read and analyze the contents of the input file, then print the results. Here is a sample run of the program. User input is shown in red. Let's analyze some text! Enter file name: sample.txt Number of lines: 21 Number of words: 184 Number of long words: 49 Number of sentences: 14 Number of...
1) Suppose an algorithm has 6 types of input given by S = {I_1, I_2, ...,...
1) Suppose an algorithm has 6 types of input given by S = {I_1, I_2, ..., I_6}. Suppose the inputs occur with the following probabilities:   P(I_2) = P(I_3) = P(I_4) = 1/12, P(I_5) = P(I_6) = 1/6, and P(I_1) = 5/12. Suppose further that each input "I_n" (n = 1,2,3,4,5,6) causes the algorithm to execute "5n" instructions. What is the expected number of instructions executed by the algorithm? 2) When three fair dice are tossed, what is the probability that...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT