Interview Question


Country: India




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

Big O notation.
my bet would be n, 22n, n^2 log(n), 2*n^2, n^2*n;

- howaboutthis March 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

a) 22n = O(n)
b) 2n2 = O(n) (or if it's 2^n * 2, then O(2^n), or if it's 2 * n^2, then O(n^2))
c) n2log(n) = O(n log(n)) (or if it's n^2 log (n), then O(n^2 log (n))
d) n = O(n)
e) n2n = O(n^2) (or if it's n^2 * n, then O(n^3)

log(n) = O(n^a) for any a > 0, so n * log (n) grows faster than n, but slower than n^2.

Any sort of exponential function grows faster than any power of n, so 2^n grows the fastest.

To encompass all possibilities, here is the order of growth in increasing order

n, 22n
n * log (n)
n^2, 2n^2
n^2 * log (n)
n^3
2^(n+1)

Your notation is atrocious.

- wesley.cho April 08, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 2 vote

Arrange the following growth rates in increasing order:
O (3n), O (n2), O (1), O (n log n)

- Anonymous September 18, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Arrange the following growth rates in increasing order:
O (3n), O (n2), O (1), O (n log n)

- sita September 18, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

1) O(1) - bounded function
2) O(3n) = O(n) - linear function
3) O(n log n) - when comparing n log n and n^2, note that log n is not bounded. However, any exponent of n grows faster than log n, so for some constant C > 0 and large enough n, log n <= C * n, and so n log n <= C * n^2 for some C > 0 and n > N for some N
4) O(n^2)

- Wesley Cho September 18, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Thanks , It's so much helpful for us.

- Arun Kumar September 28, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Thank you.....

- shilpa October 09, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Ans for IGNOU Assignment MCS031 Question:7
1) O(1) - bounded function
2) O(3n) = O(n) - linear function
3) O(n log n) - when comparing n log n and n^2, note that log n is not bounded. However, any exponent of n grows faster than log n, so for some constant C > 0 and large enough n, log n <= C * n, and so n log n <= C * n^2 for some C > 0 and n > N for some N
4) O(n^2)

- Anonymous October 15, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Arrange the following functions in increasing order of growth rate (with g(n) following f(n) in your list if and only if f(n)=O(g(n))).

a)n
b)10n
c)n1.5
d)2log⁡(n)
e)n5/3

- swapnil July 29, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

daceb i just solved it

- Bhargav May 10, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

10. Arrange the following growth rates in increasing order and justify your answer: O(n4), O(1), O(n3), O(nlogn), O( n2 logn), Ω( n2 logn), Ø(nlogn), Ø(n2), Ø(n15), Ω(n!).

- faisal February 15, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

O(1) < Q(n^1.5) < Q(nlogn) < O(nlogn) < Q(n^2) < omega(n!) < omega(n^2logn) < O(n^2logn) < O(n^3) < O(n^4)

- Prince Aggarwal May 24, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

for root values

- Anonymous July 19, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Arrange the following growth rates in increasing order:
O ((23)n ) , O (n4), O (1), O (n 3log n)

- jyoti September 07, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Please help me for this question

Arrange the following growth rates in increasing order
O ((23)n ) , O (n4), O (1), O (n 3log n)

- Jimish Shah October 01, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

a. Arrange the following growth rates in increasing order
O((23)n ),O (n4),O(1),O(n 3log n)

- Jimish Shah October 01, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Arrange the following growth rates in increasing order:
O ((23)n ) , O (n4), O (1), O (n 3log n)

- Jimish Shah October 01, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Order the given functions by increasing growth rate.

f_1(n)=n^3f
1
​ (n)=n
3


f_2(n)=n^{0.3}f
2
​ (n)=n
0.3


f_3(n)=nf
3
​ (n)=n

f_4(n)=\sqrt{n}f
4
​ (n)=
n


f_5(n)=\frac{n^2}{\sqrt{n}}f
5
​ (n)=
n

n
2



f_6(n)=n^2f
6
​ (n)=n
2

- Anonymous May 08, 2020 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Ghh

- Trrj June 13, 2021 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

) Arrange the following functions into increasing order; that is, by asymptotic growth rate 2 ^ lg(lg(n)) + (sqrt(n)) ^ lg(n); 8 ^ lg(n); 0 ^ 0; (log n)!; 2 ^ lg(n); 3 ^ (2n) I log (n!); lg(2 ^ lg(lg(n))); lg((n + 10) ^ n); (1+2+3+***+n)

- Aj September 06, 2021 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

) Arrange the following functions into increasing order; that is, by asymptotic growth rate 2 ^ lg(lg(n)) + (sqrt(n)) ^ lg(n); 8 ^ lg(n); 0 ^ 0; (log n)!; 2 ^ lg(n); 3 ^ (2n) I log (n!); lg(2 ^ lg(lg(n))); lg((n + 10) ^ n); (1+2+3+***+n)

- Aj September 06, 2021 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Arrange the following functions into increasing order growth rate :- O(n1/4), O(nl.5), O(n3lg n), O(nl.02), (n6), 2(n!), O(√n), O(n6/2), 22(2n)

- Anonymous November 20, 2021 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Arrange the following functions in the increasing order of Growth rate

n, n!, n², sqrt(n), log n, nlogn, a" (where a is constant >1)

- X August 05, 2022 | Flag Reply


Add a Comment
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.

Learn More

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.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More