Question

In: Computer Science

The runtime of a program is proportional to n1.5 where n is the input size.  For input...

The runtime of a program is proportional to n1.5 where n is the input size.  For input size 100 the runtime is 51 ms.  What is the new runtime when the input size is quadrupled?

Solutions

Expert Solution

I have tried to make the solution as simple as possible

If you have any doubts, feel free to ask in comments.

Please give this answer a like, or upvote. This will be very helpful for me.

=========================================================

Answer :

Runtime = 408 ms

=========================================================

Explanation:

Runtimes means the time taken by a program to run completely.

If a program has Runtime of 10ms , it means that it takes 10 ms for this program to be run completely.

Input is processed by program while its running. If the size or amount of input increases , the runtimes also increases in most cases.

Here in the question it is given : 'runtime of a program is propotional to  n1.5 '

So,     ∝    ,  where is Runtime.

we can write this as , = k (    ) , where k is a constant.

So, k = /   n1.5

It is given in the question that when input size is 100 , the runtime is 51ms

So,    = k (    )

=> 51 = k ()

=> k = 51/ ()

It is asked in the question that if runtime is quadrupled, whats new runtime.

So, n = 100*4 = 400.

   = k   (    )

= k ( )

   = 51/ () * ( )

    = 51/1000 * 8000

   = 408 ms

===================================================


Related Solutions

Suppose the runtime of a computer program is proportional to 2^n where n is the input...
Suppose the runtime of a computer program is proportional to 2^n where n is the input size. When given an input of size 1024, suppose the runtime is 256ms. For what input size would the program have runtime of 1ms? A program takes time proportional to the input size. If the program takes 36 milliseconds for input size 30, how  many milliseconds does it take for input size 10? A program takes time T(n) = k2n  where k is some constant and...
Write a program (O(n), where n is the number of words) that takes as input a...
Write a program (O(n), where n is the number of words) that takes as input a set of words and returns groups of anagrams for those words. Complete your code here Do not change anything in the test file. CPP File: #include #include #include #include using namespace std; vector> findAnagrams(const vector& dict); vector> findAnagrams(const vector& dict) { // Your code here... } Test File: #include #include #include #include using namespace std; vector> findAnagrams(const vector& dict); int main() { vector word_list...
Write a Java program to create an array of a specific size (which is an input...
Write a Java program to create an array of a specific size (which is an input from the user) and fill it with random numbers between 1 and 100. Then sort the array and count how many of these numbers are originally at sorted position. Display that original array, the sorted array, and the count (number of elements originally at sorted position).
Consider the following program specification: Input: An integer n > 0 and an array A[0..(n –...
Consider the following program specification: Input: An integer n > 0 and an array A[0..(n – 1)] of n integers. Output: The largest index b such that A[b] is the largest value in A[0..(n – 1)]. For example, if n = 10 and A = [ 4, 8, 1, 3, 8, 5, 4, 7, 1, 2 ] (so A[0] = 4, A[1] = 8, etc.), then the program would return 4, since the largest value in A is 8 and...
Theorem 5.1 Let n measure the size of the input for a certain task, and suppose...
Theorem 5.1 Let n measure the size of the input for a certain task, and suppose that any algorithm that solves this task must distinguish between f (n) different pos- sibilities. If an algorithm is based on an operation X that has m different outcomes, then the worst-case number of X operations this algorithm performs must be at least logm(f(n)). Consider the task of selecting a person at random from a group of n people by repeatedly rolling a single...
Runtime complexity of Insertion sort and Mergesort algirthms- and analysis with different size of inputs: In...
Runtime complexity of Insertion sort and Mergesort algirthms- and analysis with different size of inputs: In python Implement a method to sort a given array using the merge sort algorithm. Write a driver program to test the merge sort algorithm and insertion sort algorithm for the arrays of varying lengths provided.. Ex: array lenth 100, Array lenth 1000 etc. Compare the execution time of merge sort with insertion sort. Make sure you use the same array to compare the performance....
In Liinear-time selection algorithm where the input array of numbers are cut into groups of size...
In Liinear-time selection algorithm where the input array of numbers are cut into groups of size 5. Show that, when the group size is 7, the algorithm still runs in linear time.
Write a short main program that reads an integer n from standard input and prints (to...
Write a short main program that reads an integer n from standard input and prints (to standard output) n lines of * characters. The number of *’s per line should double each time, starting with 1. E.g., if n = 5, the output should be as follows: * ** **** ******** ****************
Write a program called x.c that reads an integer n from standard input, and prints an...
Write a program called x.c that reads an integer n from standard input, and prints an nxn pattern of asterisks and dashes in the shape of an "X". You can assume n is odd and >= 5. Solve this problem using only while loop. Solution: ./x Enter size: 5 *---* -*-*- --*-- -*-*- *---* ./x Enter size: 9 *-------* -*-----*- --*---*-- ---*-*--- ----*---- ---*-*--- --*---*-- -*-----*- *-------* ./x Enter size: 15 *-------------* -*-----------*- --*---------*-- ---*-------*--- ----*-----*---- -----*---*----- ------*-*------ -------*------- ------*-*------...
Write a program to implement problem statement below: provide the menu for input N and number...
Write a program to implement problem statement below: provide the menu for input N and number of experiment M to calculate average time on M runs. randomly generated list. State your estimate on the BigO number of your algorithm/program logic. (we discussed in the class) Measure the performance of your program by given different N with randomly generated list with multiple experiment of Ns against time to draw the BigO graph (using excel) we discussed during the lecture. Lab-08-BigBiggerBiggtest.png ***...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT