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
Get step-by-step solutions from verified subject matter experts
