#1: Are you just guessing? The answer is yes, but it also is no.
#2: This is a question?
Rashakil Fol
Super Senior Demiposter
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
The first question could have multiple answers.
Assuming they meant "for all n", the answer is definitely not quadratic. The runtime doubles, but only when the input size multiplies by one thousand! If it were quadratic, the runtime would double when the input size multiplies by 1.414. Just find the ration of n^2 to (1.414n)^2.
Generally, we have the relationship: f(1000n) = 2 f(n). What functions fit that relationship?
It grows a lot slower than quadratic. This means that the function is in O(n^2). But it also happens to be in O(n), and some even smaller bounds. (For being in O(n^2) means that the function grows no faster than n^2. If f(x) = x, then f(x) is in O(x^2).)
One function that fits the first equation is f(n) = n^(0.010034333189).
Because then, f(1000n) = 1000^(0.010034333189) * n^(0.010034333189) = 2*(n^0.010034333189) = 2 f(n).
If that relationship they gave only applies to a specific value of n, and not all values of n, well, then you could fit almost any type of function to those two data points. You could let f(n) = 2^n. Then at the point n = 1/999, it would be true that f(1000n) = 2 f(n), and it would not be true anywhere else.
I don't know if this is all very relevant to your exam, but that's my take on the first question.
The second is not even a question or problem, it's just a statement of fact. Is it a true/false?
Rashakil Fol
Super Senior Demiposter
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
f(n) = n + 1000
g(n) = n*n
Rashakil Fol
Super Senior Demiposter
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177