Q1: We want to prove that for some positive rational number c, P(n): T(n) >= c log(n).
- Case 1: n = 1
- No problem here: log(1) = 0, so c log(1) = 0 for all c
- Then T(1) = 1 >= 0 = c log(1) # P(1)
- Case 2: n > 1
- T(n) = 1 + T(ceiling(n / 2))
>= 1 + c log(ceiling(n / 2))
>= 1 + c log(n / 2)
>= 1 + c log(n) - c log(2)
>= 1 + c log(n) - c - What we want: turn 1 + c log(n) - c into c log(n)
Remember that we want to prove P(n) for some c
Then we can set a value of c such that P(n) holds (set c = 1)
Then T(n) >= 1 + (1) log(n) - (1)
T(n) >= (1) log(n) # P(n) for c = 1 - Then there is a rational number c such that T(n) >= c log(n).
Q2: We want to prove that for all natural number k, P(n): T(2^k) = k + 1. (Note: This is actually similar to the quiz given in the tutorial. The only difference is, in the quiz we use T(3^k), but the solution's logic is the same.)
- Base Case (n = 1): T(2) = 2 = (1) + 1 # P(1)
- Induction Step: Assume P(n) for an arbitrary natural number n.
- Then T(2^k) = k + 1
T(2^(k + 1)) = 1 + T(ceiling(2(k + 1) / 2))
= 1 + T(2^k) # we can ignore the ceiling because 2^k is always an integer
= 1 + k + 1 # by IH
= k + 2 # P(n + 1)! - Then P(n) => P(n + 1)
- Then for all natural number n, P(n)
Q3: We have to unwind G(n). Unfortunately, we didn't get the chance to finish this question during the tutorial.