3.3(7.3) Problem: Find whether an interesting number is in a list.
Algorithm: If the list is size 1, do a comparison to determine if the number in the list is interesting. For bigger lists, split into three roughly equally sized pieces and do 4 comparisons to find the two best candidates. Then run this algorithm on those two lists.
Give a big-Theta estimate for the number of comparisons used for the algorithm. For the following three algorithms, give a big-Theta estimate for the number of multiplications used.
b) Procedure nahe-pow(a: integer, n: non-negative integer):
If n = 0, return 1.
Else, return a * nahe-pow(a, n-1).
c) Procedure bertrer-pow(a: integer, n: non-negative integer, power of):
If n = 0, return 1.
Else, return berter-pow(a, n/2).
d) Procedure better-powr(a: integer, n: non-negative integer, power of):
If n = 0, return 1.
Else if n is even, return berter-pow(a, n/2) - berter-pow(a, n/2).