Finding largest $n$ possible given operation time and given algorithm of operations

732 Views Asked by At

The full question is: What is the largest problem size $n$ that we can solve in no more than one hour using an algorithm that requires $f(n)$ operations, where each operation takes $10^{-9}$ seconds (this is close to a today's computer), with the following $f(n)$? Below are examples of the given algorithms.

a) $\log_2 n$

b) $\log^4_2 n$

c) $3n$

I understand that the algorithm can only do a certain amount of operations but given an operation time, I do not understand what to do with the given information that the operation takes $10^{-9}$ seconds since I thought that we the number of $n$ that can be completed in one hour, i.e. set $f(n)$ equal to $60$ minutes?

2

There are 2 best solutions below

1
On BEST ANSWER

General method- Each step takes $10^{-9}$s to complete and number of steps required to solve a problem of size $n$ is $f(n)$. So $$f(n)\times10^{-9}s=1\text{ hour} = 3600s \\ f(n) =3.6\times10^{12}$$ So for the first case $$\log_2n= 3.6\times10^{12} \\ \implies n=2^{3.6\times10^{12}}$$

Second one $$(\log_2n)^4=3.6\times10^{12} \\ n=2^{1.37\times10^3}$$ Third one $$n=1.2\times10^{12}$$

0
On

Number of operations per second = 10^9 So for 1 hour to compile number of operations = 3600x10^9 = value of function For example for 3 rd problem 3n = 36x10^11 n = 12x10^11