Ask Question
13 October, 08:52

What is the smallest value of n such that an algorithm whose running time is 100n 2 runs faster than an algorithm whose running time is 2n on the same time.

+3
Answers (1)
  1. 13 October, 10:27
    +1
    n = 15

    Step-by-step explanation:

    For inputs of the value of n, the running time for the algorithm A is 100n^2 and that of B is 2^n.

    If A is to run faster than B, 100n^2 must be smaller than 2^n.

    Let's check from n = 1 to know the value of n that fits

    n = 1

    100 (1) ^2 > 2^1

    100 > 2

    n = 2

    100 (2) ^2 > 2^2

    400 > 4

    n = 4

    100 (4) ^2 > 2^4

    1600 > 16

    n = 8

    100 (8) ^2 > 2^8

    6400 > 2^8

    n = 16

    100 (16) ^2 < 2^16

    25600 < 2^16

    This implies that between n = 8 and 16, A starts to run faster than B

    n = (8+16) / 2 = 12

    100 (12) ^2 > 2^12

    14400 > 2^12

    n = (12+16) / 2 = 14

    100 (14) ^2 > 2^14

    19600 > 2^14

    n = (14+16) / 2

    n = 15

    100 (15) ^2 < 2^15

    22500 < 2^15

    At n = 15, A starts running faster than B
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “What is the smallest value of n such that an algorithm whose running time is 100n 2 runs faster than an algorithm whose running time is 2n ...” in 📘 Mathematics if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers