In: Computer Science
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?
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
===================================================