Question: Consider a situation where you don't have a function to use that would calculate power (like pow() function in C) and you need to calculate

Consider a situation where you don't have a function to use that would calculate power (like pow() function in C) and you need to calculate x^n, where x can be any number and n is a positive integer. What can be the best possible time complexity of your power function?

Question 1 options:

O(n)

O(n log n)

O(log n)

O(log log n)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!