Question 1

  1. Correct

  2. Correct

  3. where

    Incorrect; where are states, and .

  4. where Expands to:

    Correct

  5. Correct

Question 2

Using Master Theorem:

The Master Theorem

The Master Theorem states that for some which is a monotonically increasing recurrence relation such that:

Then we know that:

Link to original
Identify growth rates of relations: ( and )

  1. ; hence Growth rate is .

    Correct

  2. ; hence Growth rate is .

    Correct

  3. ; hence . Growth rate is .

    Correct

  4. ; hence Growth rate is .

    Correct

Question 3

Consider the following relation:SGT Sheet

Prove by induction, that for all .

  1. Basis Case: LHS: RHS: LHS = RHS
  2. Inductive Case: Assume holds where . Hence, try :

Correct

Question 4

Consider the following relation:

Prove by induction, that for all .

  1. Basis Case:
  2. Inductive Case: Assume for all for some . Now substitute : ( goal is to show )
> [!success] Correct > # Question 5 ```python def f(n): if n <= 1: return 1 else: x = f(math.floor(n / 2)) y = f(math.floor(n / 2)) return g(n, x, y) # runs in linear time O(n) ```

\begin{aligned} T(1) &= 1 \ T(n) &= 2T\begin{pmatrix} \lfloor \frac{n}{2} \rfloor \end{pmatrix} + n \end{aligned}

\begin{aligned} a &= 2 \ b &= 2 \ f(n) &= n \ k &= \log_2 (2) = 1 \ \therefore f(n) &\in \Theta(n) \ \therefore T(n) &= \Theta(n \log_2 n) \end{aligned}