235k views
4 votes
For each of the following function f(n) and time t , determine the largest size N of a problem that can be solved in time t, assuming that the algorithm to solve the problem takes f(n) microseconds. 5 seconds and 10 seconds log N N N^2 N^3 2^N

User Profet
by
7.8k points

1 Answer

2 votes

Final answer:

The largest size N of a problem that can be solved in a given time t depends on the function used to solve it. For the given functions, the largest size N for 5 seconds and 10 seconds is calculated.

Step-by-step explanation:

To determine the largest size N of a problem that can be solved in a given time t, we need to find the value of N for which f(N) = t. Let's calculate the values for each function:

  1. For log N, we have f(N) = log(N) microseconds. To solve for N, we need to find the inverse of the logarithm function, which is 10^x. So, 10^f(N) = 10^log(N) = N. Therefore, for 5 seconds, N = 10^5 = 100,000 and for 10 seconds, N = 10^10 = 10,000,000,000.
  2. For N, we have f(N) = N microseconds. So, for 5 seconds, N = 5,000,000 and for 10 seconds, N = 10,000,000.
  3. For N^2, we have f(N) = N^2 microseconds. To solve for N, we take the square root of f(N). So, for 5 seconds, N = √(5,000,000) ≈ 2,236 and for 10 seconds, N = √(10,000,000) ≈ 3,162.
  4. For N^3, we have f(N) = N^3 microseconds. To solve for N, we take the cube root of f(N). So, for 5 seconds, N = ∛(5,000,000) ≈ 368 and for 10 seconds, N = ∛(10,000,000) ≈ 464.
  5. For 2^N, we have f(N) = 2^N microseconds. To solve for N, we take the logarithm base 2 of f(N). So, for 5 seconds, N = log2(5,000,000) ≈ 22 and for 10 seconds, N = log2(10,000,000) ≈ 24.

Therefore, the largest size N of a problem that can be solved in 5 seconds is 10,000,000,000 for log N, N, and 2^N functions, and 5,000,000 and 2,236 for N^2 and N^3 functions, respectively. Similarly, the largest size N of a problem that can be solved in 10 seconds is 10,000,000,000 for log N, N, and 2^N functions, and 10,000,000 and 3,162 for N^2 and N^3 functions, respectively.

User Diman
by
7.2k points