The following are the asymptotic growth rates as functions o
The following are the asymptotic growth rates as functions of the data size (n).
4n log(n) +2n, 210, 2log(n), 3n+1--log(n), 4n, 2n, n2+10n, n3, nlog(n2)
a) Write the Big-O order of each of these growth rates
b) Arrange these growth rates in ascending order (slowest to fastest)
Solution
I am expecting, Chegg\'s Text view got format of these expressions wrong
So, I am gonna assume a few things here..
5) 4^n instead of 4n
6) 2^n instead of 2n
7) n^2+10n instead of n2+10n
8) nlog(n^2) instead of nlog(n2)
1. 4nlog(n) + 2n => O(nlog(n)), since nlog(n) is asymptotically larger than n and by removing constant terms.
2. 210 => O(1), since this is independent of n.
3. 2log(n) => O(log(n)), by removing constant term.
4. 3n+1--log(n) => O(n), since n is asymptotically larger than log(n) and also by removing constant terms.
5. 4^n => O(4^n)
6. 2^n => O(2^n)
7. n^2+10n => O(n^2), since n^2 is asymptotically larger than n and also by removing constant terms.
8. n^3 => O(n^3)
9. nlog(n^2) => O(nlog(n)), nlog(n^2) = 2nlog(n) and then by removing constant terms.
growth rates in ascending order:
Most of the time, you will have one of the following.
O(1) -> O(log(n)) -> O(n) -> O(nlog(n)) -> O(n^x) -> O(x^n) -> O(x^n) -> O(n^n)
2 -> 3 -> 4 -> 1, 9 -> 7 -> 8 -> 6 -> 5 is the order.
