Difference between revisions of "Chapter 2"

From The Algorithm Design Manual Solution Wiki
Jump to navigation Jump to search
Line 140: Line 140:
 
#<math>f(n)=n \sqrt n + n^2</math>, <math>g(n)=n^2</math>
 
#<math>f(n)=n \sqrt n + n^2</math>, <math>g(n)=n^2</math>
 
#<math>f(n)=n^2-n+1</math>, <math>g(n)=n^2/2</math>
 
#<math>f(n)=n^2-n+1</math>, <math>g(n)=n^2/2</math>
 
  
 
[[2.17|Solution]]
 
[[2.17|Solution]]
Line 219: Line 218:
  
  
:[[2.29]]. For each of the following pairs of functions <math>f(n)</math> and <math>g(n)</math>, state whether <math>f(n)=O(g(n))</math>, <math>f(n)=\Omega(g(n))</math>, <math>f(n)=\Theta(g(n))</math>, or none
+
:[[2.29]]. For each of the following pairs of functions <math>f(n)</math> and <math>g(n)</math>, state whether <math>f(n)=O(g(n))</math>, <math>f(n)=\Omega(g(n))</math>, <math>f(n)=\Theta(g(n))</math>, or none of the above.
of the above.
 
 
#<math>f(n)=n^2+3n+4</math>, <math>g(n)=6n+7</math>
 
#<math>f(n)=n^2+3n+4</math>, <math>g(n)=6n+7</math>
 
#<math>f(n)=n \sqrt n</math>, <math>g(n)=n^2-n</math>
 
#<math>f(n)=n \sqrt n</math>, <math>g(n)=n^2-n</math>
 
#<math>f(n)=2^n - n^2</math>, <math>g(n)=n^4+n^2</math>
 
#<math>f(n)=2^n - n^2</math>, <math>g(n)=n^4+n^2</math>
 
  
 
[[2.29|Solution]].  
 
[[2.29|Solution]].  
Line 231: Line 228:
 
:2.30. For each of these questions, briefly explain your answer.
 
:2.30. For each of these questions, briefly explain your answer.
 
<br>
 
<br>
(a) If I prove that an algorithm takes <math>O(n^2)</math> worst-case time, is it
+
::(a) If I prove that an algorithm takes <math>O(n^2)</math> worst-case time, is it possible that it takes <math>O(n)</math> on some inputs?
possible that it takes <math>O(n)</math> on some inputs?
 
 
<br>
 
<br>
(b) If I prove that an algorithm takes <math>O(n^2)</math> worst-case time, is it
+
::(b) If I prove that an algorithm takes <math>O(n^2)</math> worst-case time, is it possible that it takes <math>O(n)</math> on all inputs?
possible that
 
it takes <math>O(n)</math> on all inputs?
 
 
<br>
 
<br>
(c) If I prove that an algorithm takes <math>\Theta(n^2)</math> worst-case time, is it
+
::(c) If I prove that an algorithm takes <math>\Theta(n^2)</math> worst-case time, is it possible that it takes <math>O(n)</math> on some inputs?
possible that it takes <math>O(n)</math> on some inputs?
 
 
<br>
 
<br>
(d) If I prove that an algorithm takes <math>\Theta(n^2)</math> worst-case time,
+
::(d) If I prove that an algorithm takes <math>\Theta(n^2)</math> worst-case time, is it possible that it takes <math>O(n)</math> on all inputs?
is it possible that it takes <math>O(n)</math> on all inputs?
 
 
<br>
 
<br>
(e) Is the function <math>f(n) = \Theta(n^2)</math>, where <math>f(n) = 100 n^2</math> for even <math>n</math>
+
::(e) Is the function <math>f(n) = \Theta(n^2)</math>, where <math>f(n) = 100 n^2</math> for even <math>n</math> and <math>f(n) = 20 n^2 - n \log_2 n</math> for odd <math>n</math>?
and <math>f(n) = 20 n^2 - n \log_2 n</math> for odd <math>n</math>?
 
  
  
 
:[[2.31]]. For each of the following, answer ''yes'', ''no'', or ''can't tell''. Explain your reasoning.
 
:[[2.31]]. For each of the following, answer ''yes'', ''no'', or ''can't tell''. Explain your reasoning.
 
<br>
 
<br>
(a) Is <math>3^n = O(2^n)</math>?
+
::(a) Is <math>3^n = O(2^n)</math>?
 
<br>
 
<br>
(b) Is <math>\log 3^n = O( \log 2^n )</math>?
+
::(b) Is <math>\log 3^n = O( \log 2^n )</math>?
 
<br>
 
<br>
(c) Is <math>3^n = \Omega(2^n)</math>?
+
::(c) Is <math>3^n = \Omega(2^n)</math>?
 
<br>
 
<br>
(d) Is <math>\log 3^n = \Omega( \log 2^n )</math>?
+
::(d) Is <math>\log 3^n = \Omega( \log 2^n )</math>?
  
 
[[2.31|Solution]]
 
[[2.31|Solution]]
  
  
:2.32. For each of the following expressions <math>f(n)</math> find a simple <math>g(n)</math> such that
+
:2.32. For each of the following expressions <math>f(n)</math> find a simple <math>g(n)</math> such that <math>f(n)=\Theta(g(n))</math>.
<math>f(n)=\Theta(g(n))</math>.
+
::#<math>f(n)=\sum_{i=1}^n {1\over i}</math>.
#<math>f(n)=\sum_{i=1}^n {1\over i}</math>.
 
 
#<math>f(n)=\sum_{i=1}^n \lceil {1\over i}\rceil</math>.
 
#<math>f(n)=\sum_{i=1}^n \lceil {1\over i}\rceil</math>.
 
#<math>f(n)=\sum_{i=1}^n \log i</math>.
 
#<math>f(n)=\sum_{i=1}^n \log i</math>.
Line 274: Line 264:
 
<math>f_3(n) = \sum_{i=0}^n 2^i</math>,
 
<math>f_3(n) = \sum_{i=0}^n 2^i</math>,
 
<math>f_4(n) = \log_2(\sum_{i=0}^n 2^i)</math>.
 
<math>f_4(n) = \log_2(\sum_{i=0}^n 2^i)</math>.
 
  
 
[[2.33|Solution]]
 
[[2.33|Solution]]
Line 300: Line 289:
 
<br><math>
 
<br><math>
 
\begin{array}{lcc}
 
\begin{array}{lcc}
        & A                    & B \\
+
::        & A                    & B \\
(a)    & n^{100}              & 2^n \\
+
::(a)    & n^{100}              & 2^n \\
(b)    & (\lg n)^{12}        & \sqrt{n} \\
+
::(b)    & (\lg n)^{12}        & \sqrt{n} \\
(c)    & \sqrt{n}              & n^{\cos (\pi n/8)} \\
+
::(c)    & \sqrt{n}              & n^{\cos (\pi n/8)} \\
(d)    & 10^n                  & 100^n \\
+
::(d)    & 10^n                  & 100^n \\
(e)    & n^{\lg n}            & (\lg n)^n \\
+
::(e)    & n^{\lg n}            & (\lg n)^n \\
(f)    & \lg{(n!)}            & n \lg n
+
::(f)    & \lg{(n!)}            & n \lg n
 
\end{array}
 
\end{array}
 
</math>
 
</math>

Revision as of 16:45, 7 September 2020

Algorithm Analysis

Program Analysis

2.1. What value is returned by the following function? Express your answer as a function of [math]\displaystyle{ n }[/math]. Give the worst-case running time using the Big Oh notation.
  mystery(n)
      r:=0
      for i:=1 to n-1 do
          for j:=i+1 to n do
              for k:=1 to j do
                  r:=r+1
       return(r)

Solution


2.2. What value is returned by the following function? Express your answer as a function of [math]\displaystyle{ n }[/math]. Give the worst-case running time using Big Oh notation.
   pesky(n)
       r:=0
       for i:=1 to n do
           for j:=1 to i do
               for k:=j to i+j do
                   r:=r+1
       return(r)


2.3. What value is returned by the following function? Express your answer as a function of [math]\displaystyle{ n }[/math]. Give the worst-case running time using Big Oh notation.
   prestiferous(n)
       r:=0
       for i:=1 to n do
           for j:=1 to i do
               for k:=j to i+j do
                   for l:=1 to i+j-k do
                       r:=r+1
       return(r) 

Solution


2.4. What value is returned by the following function? Express your answer as a function of [math]\displaystyle{ n }[/math]. Give the worst-case running time using Big Oh notation.
  conundrum([math]\displaystyle{ n }[/math])
      [math]\displaystyle{ r:=0 }[/math]
      for [math]\displaystyle{ i:=1 }[/math] to [math]\displaystyle{ n }[/math] do
      for [math]\displaystyle{ j:=i+1 }[/math] to [math]\displaystyle{ n }[/math] do
      for [math]\displaystyle{ k:=i+j-1 }[/math] to [math]\displaystyle{ n }[/math] do
      [math]\displaystyle{ r:=r+1 }[/math]
      return(r)


2.5. Consider the following algorithm: (the print operation prints a single asterisk; the operation [math]\displaystyle{ x = 2x }[/math] doubles the value of the variable [math]\displaystyle{ x }[/math]).
   for [math]\displaystyle{  k = 1 }[/math] to [math]\displaystyle{ n }[/math]
       [math]\displaystyle{ x = k }[/math]
       while ([math]\displaystyle{ x \lt  n }[/math]):
          print '*'
          [math]\displaystyle{ x = 2x }[/math]
Let [math]\displaystyle{ f(n) }[/math] be the complexity of this algorithm (or equivalently the number of times * is printed). Proivde correct bounds for [math]\displaystyle{ O(f(n)) }[/math], and [math]\displaystyle{ /Theta(f(n)) }[/math], ideally converging on [math]\displaystyle{ \Theta(f(n)) }[/math].

Solution


2.6. Suppose the following algorithm is used to evaluate the polynomial
[math]\displaystyle{ p(x)=a_n x^n +a_{n-1} x^{n-1}+ \ldots + a_1 x +a_0 }[/math]
   [math]\displaystyle{ p:=a_0; }[/math]
   [math]\displaystyle{ xpower:=1; }[/math]
   for [math]\displaystyle{ i:=1 }[/math] to [math]\displaystyle{ n }[/math] do
   [math]\displaystyle{ xpower:=x*xpower; }[/math]
   [math]\displaystyle{ p:=p+a_i * xpower }[/math]
  1. How many multiplications are done in the worst-case? How many additions?
  2. How many multiplications are done on the average?
  3. Can you improve this algorithm?


2.7. Prove that the following algorithm for computing the maximum value in an array [math]\displaystyle{ A[1..n] }[/math] is correct.
  max(A)
     [math]\displaystyle{ m:=A[1] }[/math]
     for [math]\displaystyle{ i:=2 }[/math] to n do
           if [math]\displaystyle{ A[i] \gt  m }[/math] then [math]\displaystyle{ m:=A[i] }[/math]
     return (m)

Solution

Big Oh

2.8. True or False?
  1. Is [math]\displaystyle{ 2^{n+1} = O (2^n) }[/math]?
  2. Is [math]\displaystyle{ 2^{2n} = O(2^n) }[/math]?


2.9. For each of the following pairs of functions, either [math]\displaystyle{ f(n ) }[/math] is in [math]\displaystyle{ O(g(n)) }[/math], [math]\displaystyle{ f(n) }[/math] is in [math]\displaystyle{ \Omega(g(n)) }[/math], or [math]\displaystyle{ f(n)=\Theta(g(n)) }[/math]. Determine which relationship is correct and briefly explain why.
  1. [math]\displaystyle{ f(n)=\log n^2 }[/math]; [math]\displaystyle{ g(n)=\log n }[/math] + [math]\displaystyle{ 5 }[/math]
  2. [math]\displaystyle{ f(n)=\sqrt n }[/math]; [math]\displaystyle{ g(n)=\log n^2 }[/math]
  3. [math]\displaystyle{ f(n)=\log^2 n }[/math]; [math]\displaystyle{ g(n)=\log n }[/math]
  4. [math]\displaystyle{ f(n)=n }[/math]; [math]\displaystyle{ g(n)=\log^2 n }[/math]
  5. [math]\displaystyle{ f(n)=n \log n + n }[/math]; [math]\displaystyle{ g(n)=\log n }[/math]
  6. [math]\displaystyle{ f(n)=10 }[/math]; [math]\displaystyle{ g(n)=\log 10 }[/math]
  7. [math]\displaystyle{ f(n)=2^n }[/math]; [math]\displaystyle{ g(n)=10 n^2 }[/math]
  8. [math]\displaystyle{ f(n)=2^n }[/math]; [math]\displaystyle{ g(n)=3^n }[/math]

Solution


2.10. For each of the following pairs of functions [math]\displaystyle{ f(n) }[/math] and [math]\displaystyle{ g(n) }[/math], determine whether [math]\displaystyle{ f(n) = O(g(n)) }[/math], [math]\displaystyle{ g(n) = O(f(n)) }[/math], or both.
  1. [math]\displaystyle{ f(n) = (n^2 - n)/2 }[/math], [math]\displaystyle{ g(n) =6n }[/math]
  2. [math]\displaystyle{ f(n) = n +2 \sqrt n }[/math], [math]\displaystyle{ g(n) = n^2 }[/math]
  3. [math]\displaystyle{ f(n) = n \log n }[/math], [math]\displaystyle{ g(n) = n \sqrt n /2 }[/math]
  4. [math]\displaystyle{ f(n) = n + \log n }[/math], [math]\displaystyle{ g(n) = \sqrt n }[/math]
  5. [math]\displaystyle{ f(n) = 2(\log n)^2 }[/math], [math]\displaystyle{ g(n) = \log n + 1 }[/math]
  6. [math]\displaystyle{ f(n) = 4n\log n + n }[/math], [math]\displaystyle{ g(n) = (n^2 - n)/2 }[/math]


2.11. For each of the following functions, which of the following asymptotic bounds hold for [math]\displaystyle{ f(n) = O(g(n)),\Theta(g(n)),\Omega(g(n)) }[/math]?

Solution


2.12. Prove that [math]\displaystyle{ n^3 - 3n^2-n+1 = \Theta(n^3) }[/math].


2.13. Prove that [math]\displaystyle{ n^2 = O(2^n) }[/math].

Solution


2.14. Prove or disprove: [math]\displaystyle{ \Theta(n^2) = \Theta(n^2+1) }[/math].


2.15. Suppose you have algorithms with the five running times listed below. (Assume these are the exact running times.) How much slower do each of these inputs get when you (a) double the input size, or (b) increase the input size by one?
(a) [math]\displaystyle{ n^2 }[/math] (b) [math]\displaystyle{ n^3 }[/math] (c) [math]\displaystyle{ 100n^2 }[/math] (d) [math]\displaystyle{ nlogn }[/math] (e) [math]\displaystyle{ 2^n }[/math]

Solution


2.16. Suppose you have algorithms with the six running times listed below. (Assume these are the exact number of operations performed as a function of input size [math]\displaystyle{ n }[/math].)Suppose you have a computer that can perform [math]\displaystyle{ 10^10 }[/math] operations per second. For each algorithm, what is the largest input size n that you can complete within an hour?
(a) [math]\displaystyle{ n^2 }[/math] (b) [math]\displaystyle{ n^3 }[/math] (c) [math]\displaystyle{ 100n^2 }[/math] (d) [math]\displaystyle{ nlogn }[/math] (e) [math]\displaystyle{ 2^n }[/math] (f) [math]\displaystyle{ 2^{2^n} }[/math]


2.17. For each of the following pairs of functions [math]\displaystyle{ f(n) }[/math] and [math]\displaystyle{ g(n) }[/math], give an appropriate positive constant [math]\displaystyle{ c }[/math] such that [math]\displaystyle{ f(n) \leq c \cdot g(n) }[/math] for all [math]\displaystyle{ n \gt 1 }[/math].
  1. [math]\displaystyle{ f(n)=n^2+n+1 }[/math], [math]\displaystyle{ g(n)=2n^3 }[/math]
  2. [math]\displaystyle{ f(n)=n \sqrt n + n^2 }[/math], [math]\displaystyle{ g(n)=n^2 }[/math]
  3. [math]\displaystyle{ f(n)=n^2-n+1 }[/math], [math]\displaystyle{ g(n)=n^2/2 }[/math]

Solution


2.18. Prove that if [math]\displaystyle{ f_1(n)=O(g_1(n)) }[/math] and [math]\displaystyle{ f_2(n)=O(g_2(n)) }[/math], then [math]\displaystyle{ f_1(n)+f_2(n) = O(g_1(n)+g_2(n)) }[/math].


2.19. Prove that if [math]\displaystyle{ f_1(N)=\Omega(g_1(n)) }[/math] and [math]\displaystyle{ f_2(n)=\Omega(g_2(n) }[/math], then [math]\displaystyle{ f_1(n)+f_2(n)=\Omega(g_1(n)+g_2(n)) }[/math].

Solution


2.20. Prove that if [math]\displaystyle{ f_1(n)=O(g_1(n)) }[/math] and [math]\displaystyle{ f_2(n)=O(g_2(n)) }[/math], then [math]\displaystyle{ f_1(n) \cdot f_2(n) = O(g_1(n) \cdot g_2(n)) }[/math]


2.21. Prove for all [math]\displaystyle{ k \geq 1 }[/math] and all sets of constants [math]\displaystyle{ \{a_k, a_{k-1}, \ldots, a_1,a_0\} \in R }[/math], [math]\displaystyle{ a_k n^k + a_{k-1}n^{k-1}+....+a_1 n + a_0 = O(n^k) }[/math]

Solution


2.22. Show that for any real constants [math]\displaystyle{ a }[/math] and [math]\displaystyle{ b }[/math], [math]\displaystyle{ b \gt 0 }[/math]
[math]\displaystyle{ (n + a)^b = \Omega (n^b) }[/math]


2.23. List the functions below from the lowest to the highest order. If any two or more are of the same order, indicate which.

[math]\displaystyle{ \begin{array}{llll} n & 2^n & n \lg n & \ln n \\ n-n^3+7n^5 & \lg n & \sqrt n & e^n \\ n^2+\lg n & n^2 & 2^{n-1} & \lg \lg n \\ n^3 & (\lg n)^2 & n! & n^{1+\varepsilon} where 0\lt \varepsilon \lt 1 \\ \end{array} }[/math]

Solution


2.24


2.25

Solution


2.26. List the functions below from the lowest to the highest order. If any two or more are of the same order, indicate which.

[math]\displaystyle{ \begin{array}{lll} \sqrt{n} & n & 2^n \\ n \log n & n - n^3 + 7n^5 & n^2 + \log n \\ n^2 & n^3 & \log n \\ n^{\frac{1}{3}} + \log n & (\log n)^2 & n! \\ \ln n & \frac{n}{\log n} & \log \log n \\ ({1}/{3})^n & ({3}/{2})^n & 6 \\ \end{array} }[/math]


2.27. Find two functions [math]\displaystyle{ f(n) }[/math] and [math]\displaystyle{ g(n) }[/math] that satisfy the following relationship. If no such [math]\displaystyle{ f }[/math] and [math]\displaystyle{ g }[/math] exist, write None.
  1. [math]\displaystyle{ f(n)=o(g(n)) }[/math] and [math]\displaystyle{ f(n) \neq \Theta(g(n)) }[/math]
  2. [math]\displaystyle{ f(n)=\Theta(g(n)) }[/math] and [math]\displaystyle{ f(n)=o(g(n)) }[/math]
  3. [math]\displaystyle{ f(n)=\Theta(g(n)) }[/math] and [math]\displaystyle{ f(n) \neq O(g(n)) }[/math]
  4. [math]\displaystyle{ f(n)=\Omega(g(n)) }[/math] and [math]\displaystyle{ f(n) \neq O(g(n)) }[/math]

Solution


2.28. True or False?
  1. [math]\displaystyle{ 2n^2+1=O(n^2) }[/math]
  2. [math]\displaystyle{ \sqrt n= O(\log n) }[/math]
  3. [math]\displaystyle{ \log n = O(\sqrt n) }[/math]
  4. [math]\displaystyle{ n^2(1 + \sqrt n) = O(n^2 \log n) }[/math]
  5. [math]\displaystyle{ 3n^2 + \sqrt n = O(n^2) }[/math]
  6. [math]\displaystyle{ \sqrt n \log n= O(n) }[/math]
  7. [math]\displaystyle{ \log n=O(n^{-1/2}) }[/math]


2.29. For each of the following pairs of functions [math]\displaystyle{ f(n) }[/math] and [math]\displaystyle{ g(n) }[/math], state whether [math]\displaystyle{ f(n)=O(g(n)) }[/math], [math]\displaystyle{ f(n)=\Omega(g(n)) }[/math], [math]\displaystyle{ f(n)=\Theta(g(n)) }[/math], or none of the above.
  1. [math]\displaystyle{ f(n)=n^2+3n+4 }[/math], [math]\displaystyle{ g(n)=6n+7 }[/math]
  2. [math]\displaystyle{ f(n)=n \sqrt n }[/math], [math]\displaystyle{ g(n)=n^2-n }[/math]
  3. [math]\displaystyle{ f(n)=2^n - n^2 }[/math], [math]\displaystyle{ g(n)=n^4+n^2 }[/math]

Solution.


2.30. For each of these questions, briefly explain your answer.


(a) If I prove that an algorithm takes [math]\displaystyle{ O(n^2) }[/math] worst-case time, is it possible that it takes [math]\displaystyle{ O(n) }[/math] on some inputs?


(b) If I prove that an algorithm takes [math]\displaystyle{ O(n^2) }[/math] worst-case time, is it possible that it takes [math]\displaystyle{ O(n) }[/math] on all inputs?


(c) If I prove that an algorithm takes [math]\displaystyle{ \Theta(n^2) }[/math] worst-case time, is it possible that it takes [math]\displaystyle{ O(n) }[/math] on some inputs?


(d) If I prove that an algorithm takes [math]\displaystyle{ \Theta(n^2) }[/math] worst-case time, is it possible that it takes [math]\displaystyle{ O(n) }[/math] on all inputs?


(e) Is the function [math]\displaystyle{ f(n) = \Theta(n^2) }[/math], where [math]\displaystyle{ f(n) = 100 n^2 }[/math] for even [math]\displaystyle{ n }[/math] and [math]\displaystyle{ f(n) = 20 n^2 - n \log_2 n }[/math] for odd [math]\displaystyle{ n }[/math]?


2.31. For each of the following, answer yes, no, or can't tell. Explain your reasoning.


(a) Is [math]\displaystyle{ 3^n = O(2^n) }[/math]?


(b) Is [math]\displaystyle{ \log 3^n = O( \log 2^n ) }[/math]?


(c) Is [math]\displaystyle{ 3^n = \Omega(2^n) }[/math]?


(d) Is [math]\displaystyle{ \log 3^n = \Omega( \log 2^n ) }[/math]?

Solution


2.32. For each of the following expressions [math]\displaystyle{ f(n) }[/math] find a simple [math]\displaystyle{ g(n) }[/math] such that [math]\displaystyle{ f(n)=\Theta(g(n)) }[/math].
  1. [math]\displaystyle{ f(n)=\sum_{i=1}^n {1\over i} }[/math].
  1. [math]\displaystyle{ f(n)=\sum_{i=1}^n \lceil {1\over i}\rceil }[/math].
  2. [math]\displaystyle{ f(n)=\sum_{i=1}^n \log i }[/math].
  3. [math]\displaystyle{ f(n)=\log (n!) }[/math].


2.33. Place the following functions into increasing asymptotic order.

[math]\displaystyle{ f_1(n) = n^2\log_2n }[/math], [math]\displaystyle{ f_2(n) = n(\log_2n)^2 }[/math], [math]\displaystyle{ f_3(n) = \sum_{i=0}^n 2^i }[/math], [math]\displaystyle{ f_4(n) = \log_2(\sum_{i=0}^n 2^i) }[/math].

Solution


2.34. Which of the following are true?
  1. [math]\displaystyle{ \sum_{i=1}^n 3^i = \Theta(3^{n-1}) }[/math].
  2. [math]\displaystyle{ \sum_{i=1}^n 3^i = \Theta(3^n) }[/math].
  3. [math]\displaystyle{ \sum_{i=1}^n 3^i = \Theta(3^{n+1}) }[/math].


2.35. For each of the following functions [math]\displaystyle{ f }[/math] find a simple function [math]\displaystyle{ g }[/math] such that [math]\displaystyle{ f(n)=\Theta(g(n)) }[/math].
  1. [math]\displaystyle{ f_1(n)= (1000)2^n + 4^n }[/math].
  2. [math]\displaystyle{ f_2(n)= n + n\log n + \sqrt n }[/math].
  3. [math]\displaystyle{ f_3(n)= \log (n^{20}) + (\log n)^{10} }[/math].
  4. [math]\displaystyle{ f_4(n)= (0.99)^n + n^{100}. }[/math]

Solution


2.36. For each pair of expressions [math]\displaystyle{ (A,B) }[/math] below,

indicate whether [math]\displaystyle{ A }[/math] is [math]\displaystyle{ O }[/math], [math]\displaystyle{ o }[/math], [math]\displaystyle{ \Omega }[/math], [math]\displaystyle{ \omega }[/math], or [math]\displaystyle{ \Theta }[/math] of [math]\displaystyle{ B }[/math]. Note that zero, one or more of these relations may hold for a given pair; list all correct ones.
[math]\displaystyle{ \begin{array}{lcc} :: & A & B \\ ::(a) & n^{100} & 2^n \\ ::(b) & (\lg n)^{12} & \sqrt{n} \\ ::(c) & \sqrt{n} & n^{\cos (\pi n/8)} \\ ::(d) & 10^n & 100^n \\ ::(e) & n^{\lg n} & (\lg n)^n \\ ::(f) & \lg{(n!)} & n \lg n \end{array} }[/math]

Summations

2.37
2.38
2.39
2.40
2.41
2.42
2.43

Logartihms

2.44
2.45
2.46
2.47

Interview Problems

2.48
2.49
2.50
2.51
2.52
2.53
2.54
2.55


Back to Chapter List