Background: Calculation an exponential, nº, can be done using iteration by multiplying a number repeatedly. However, thi
Posted: Mon Jun 06, 2022 2:23 pm
Background: Calculation an exponential, nº, can be done using iteration by multiplying a number repeatedly. However, this problem can also be solved using recursion and in a more efficient way, specifically O(log(n)). Remember your exponent rules, specially nº x n = nota Problem: You need to write a recursive algorithm that evaluates an exponential in O(log(n)) time. It should take two numbers n and p and return the result of nº. input: n, p: Integer values representing an exponential. output: the evaluated value of the exponential // Your pseudo code here