1. Ordered from slowest growing to fastest growing:

^{5}, this is the same as

The inequality holds when n=1 and c=32 (check).

All terms except 1 on the left side are decreasing functions of n.

Therefore when n ≥ n_{0} = 1, c = 32, the inequality holds.
This completes the proof.

- 1/n < 2
^{100}< log log n < log^{2}n < n^{0.01}< ⌈ sqrt(n) ⌉ < 2^{log2 n}< 6n log n < 4n^{3/2}< 2^{2n}

2.

1 Hour | 2 Hours | |

log n | 2^{36*108} | 2^{72*108} |

sqrt(n) | 1296*10^{19} | 5184*10^{19} |

n | 36*10^{8} | 72*10^{8} |

n log n | 1.33*10^{8} | 2.58*10^{8} |

n^{2} | 60000 | 8.49*10^{4} |

n^{3} | 1532.62 | 1930.98 |

2^{n} | 31 | 32 |

n! | 12 | 13 |

3.

We want the following inequality to hold for a constant c when n ≥ n_{0}:

- n
^{5}+ 5n^{4}+ 10n^{3}+ 10n^{2}+ 5n + 1 ≤ cn^{5}.

- (n
^{5}+ 5n^{4}+ 10n^{3}+ 10n^{2}+ 5n + 1)/n^{5}≤ (cn^{5})/n^{5}.

- 1 + 5/n + 10/(n
^{2}) + 10/(n^{3}) + 5/(n^{4}) + 1/(n^{5}) ≤ c.

The inequality holds when n=1 and c=32 (check).

All terms except 1 on the left side are decreasing functions of n.

Therefore when n ≥ n

4.

Algorithm (Input: X = (a_{1}, a_{2}, a_{3},.. a_{n}), Output: A = (A_{1}, A_{2}, ..., A_{n})

1. A[1] = X[1]

2. print A[1]

3. for i=2 to n

4. ___ A[i] = A[i-1] + X[i]

5. ___ print A[i]

6. end for

Complexity: The algorithm clearly runs in O(n) time.

Correctness: Clearly, A[i] = a[1] + a[2] + ... + a[i]. (prove by induction on i if you want to be formal).

5.

**(tasters)** Let n be the number of bottles. Let k = ⌈ log_{2} n ⌉ and choose k testers, call them 1,2,..,k.
There are 2^{k} ≥ n subsets of {1,2,...,k}.
For i = 1,2,...,n, pair the i'th bottle with the i'th subset S_{i} of {1,2,...,k},
and have the tasters in that subset taste the i'th bottle.

If the i'th bottle is poisoned, then at the end of the month,
exactly those tasters in the set S_{i} will die. This will identify
which bottle is poisoned.

**(missing number)** Here are two algorithms. Let the array be A[1..n-1].

Algorithm 1:

- Compute T = 1+2+3+...+n and S = A[1] + A[2] + ... + A[n-1]. Then T-S is the missing number.

Algorithm 2:

- Use the partition procedure from quicksort to reorder the array so that the numbers less than n/2 are in the first half of the array, while the other numbers are in the second half of the array.
- By counting the numbers in the two halves of the array, determine whether the missing number is less than n/2 or ≥ n/2.
- Recurse on whichever half of the array the missing number is missing from.

Total time: n + n/2 + n/4 + n/8 + ... = O(n)