## Amazon Interview Question for Software Development Managers

• 0

Country: India

Comment hidden because of low score. Click to expand.
1
of 1 vote

I.e. IF f(n) = O(g(n)) ie. C*g(n) is an upper bound on f(n), where C is a constant,
2 f(n) = O(2g(n)) as 2g(n) WILL always be an upper bound on 2 f(n).

Comment hidden because of low score. Click to expand.
0
of 0 vote

Yes

since f(n) = O(g(n) ) means

f(n) <= C*g(n) where C > 0 constant

so 2*f(n) <= 2*C*g(n) will always true

Comment hidden because of low score. Click to expand.
0
of 0 vote

If O is function, then answer is (2), if O is constant, then answer is (4)

if f(n) = O(g(n)) = g(n)^2 Note: O(x) = x^2
then 2f(n) = 2O(g(n)) = 2g(n)^2

using this O function, if g(n) = 3, then f(n) = O(3) = 3^2 = 9
2f(n) = 18, O(2g(n)) = O(2x3) = O(6) = 6^2 = 36.
So, 2f(n) <= O(2g(n)).

But if O function = SQRT(x), then:
if g(n) = 3, then f(n) = O(3) = SQRT(3)
2f(n) = 2*SQRT(3), O(2g(n)) = SQRT(2x3) = SQRT(6)
in this case, 2f(n) > O(2xg(n))

So, I think answer is (2)

Comment hidden because of low score. Click to expand.
0

Keep it up bro . See you in Amazon :P .

Comment hidden because of low score. Click to expand.
0

great prove

Comment hidden because of low score. Click to expand.
0

i am lost, what is this? some mathematical theorem? O is neither function nor constant, it is in the order of

Comment hidden because of low score. Click to expand.
0
of 0 vote

^ Doesn't know what asymptotic analysis is, please stop considering algorithms as your imaginational playground and learn some math.

Comment hidden because of low score. Click to expand.
0
of 0 vote

Always

Comment hidden because of low score. Click to expand.
0
of 0 vote

Always

Comment hidden because of low score. Click to expand.
0
of 0 vote
Is 2f(n)=O(2g(n))? effectively implies is 2f(n)=O(g(n))? Because, in Big-Oh notation, we drop the leading constants. To answer "is 2f(n)=O(g(n))?", we have: {{{ f(n)=O(g(n)), which means f(n) <= Cg(n), for some C>0 & for all n >n0 Multiply by 2 on both the sides 2f(n) <= 2Cg(n) Now let D= 2C 2f(n) <=Dg(n), which implies 2f(n) = O(g(n)) Hence 4(Always) is the answer. Since 4(Always) is the answer, 1(Never) and 2(Sometimes) are NOT the answers. 3(Yes if f(n)≤g(n) for all sufficiently large n) is an implication of the assertion "f(n)=O(g(n))" provided in the question. Therefore, it is a part of the question and is not an answer
Comment hidden because of low score. Click to expand.
0

Is 2f(n)=O(2g(n))? effectively implies is 2f(n)=O(g(n))? Because, in Big-Oh notation, we drop the leading constants.

To answer "is 2f(n)=O(g(n))?", we have:

``````f(n)=O(g(n)), which means
f(n) <= Cg(n), for some C>0 & for all n >n0

Multiply by 2 on both the sides
2f(n) <= 2Cg(n).  Now let D= 2C
2f(n) <=Dg(n), which implies
2f(n) = O(g(n))

Hence 4(Always) is the answer. Since 4(Always) is the answer, 1(Never) and 2(Sometimes) are NOT the answers. 3(Yes if f(n)≤g(n) for all sufficiently large n) is an implication of the assertion "f(n)=O(g(n))" provided in the question. Therefore, it is a part of the question and is not an answer.``````

Comment hidden because of low score. Click to expand.
0
of 0 vote

ans is a..consider the case f(n)=g(n)

Comment hidden because of low score. Click to expand.
0
of 0 vote

Hello.. I am too facing this question, but 4(always) is not only the answer,actually it's my quiz problem in coursera analysis and design of algorithm course, and its wrong for only option 4.. should we consider option 3 also?

Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

### Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

### Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.