Question: Consider the functions power ( base , exp ) and betterPower ( base , exp ) that recursively calculate the value of base raised to
Consider the functions power base exp and betterPower base exp that recursively calculate the value of base raised to exp.
def power :
if :
return
return power
def betterPower :
if :
return
if :
return betterPowerb x betterPowerb x
else:
return betterPower betterPower
Compared to power betterPower is:
not comparable
has worse BigO time complexity
has better BigO time complexity
has the same BigO time complexity
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
