b) Complexity

We are given that the runtime complexity of a single blit operation for a section of dimentions \(n\cdot n\), is \(\mathcal{O}(n^2)\).

Given this information, the runtime complexity of the rotation algorithm can be expressed as: \[T(n) = \begin{cases} 0, & n=1\\ 5 \cdot (\frac{n}{2})^2 + 4 T(\frac{n}{2}), & n > 1 \end{cases}\]

Once again, we use \(n=2^x\) for increasing values of \(x\) and try to find a pattern.

\[\begin{aligned} T(2^0) &= T(1) = 0\\ T(2^1) &= 5 \cdot (2^0)^2 + 4 T(2^0) = 5 + 0 = 5\\ T(2^2) &= 5 \cdot (2^1)^2 + 4 T(2^1)\\ &= 5 \cdot 4^1 + 4 \cdot 5 = 2(5 \cdot 4)\\ T(2^3) &= 5 \cdot (2^2)^2 + 4 T(2^2)\\ &= 5 \cdot 4^2 + 4(2(5 \cdot 4^1))\\ &= 5 \cdot 4^2 + 2(5 \cdot 4^2) = 3(5 \cdot 4^2)\\ T(2^4) &= 5 \cdot (2^3)^2 + 4 T(2^3)\\ &= 5 \cdot 4^3 + 4(3(5 \cdot 4^2))\\ &= 5 \cdot 4^3 + 3(5 \cdot 4^3) = 4(5 \cdot 4^3)\\ T(2^5) &= 5 \cdot (2^4)^2 + 4 T(2^4)\\ &= 5 \cdot 4^4 + 4(4(5 \cdot 4^3))\\ &= 5 \cdot 4^4 + 4(5 \cdot 4^4) = 5(5 \cdot 4^4)\\\end{aligned}\]