When we write powering a number as a divide and conquer algorithm in theoretical computer science the runtime would be T(n) = 2T(n/2) + Θ(1)
in my opinion, yet according to my teacher's slides it is T(n) = T(n/2) + Θ(1)
. Why that? I added the 2 because the algorithm gets split into 2 subproblems? Am I wrong?
In each step the problem is divided into two small identical parts. Since these are identical, there is no need to do the computation for each of those. Therefore there is no need to a multiplier 2
.