Skip to content
Related Articles

Related Articles

Algorithms | Divide and Conquer | Question 5

View Discussion
Improve Article
Save Article
  • Last Updated : 28 Jun, 2021

Consider a situation where you don’t have function to calculate power (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?
(A) O(n)
(B) O(nLogn)
(C) O(LogLogn)
(D) O(Logn)

Answer: (D)

Explanation: We can calculate power using divide and conquer in O(Logn) time. See

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!