Background: Calculation an exponential, nº, can be done using iteration by multiplying a number repeatedly. However, thi
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Background: Calculation an exponential, nº, can be done using iteration by multiplying a number repeatedly. However, thi
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
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!