Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd FastPow #1791
Add FastPow #1791
Comments
This PR tries to solve TheAlgorithms#1791 implementing a faster algorithm. The old algorithm used recursion which takes O(n) time to run, being n the exponent. This new algorithm uses the paradigm of `divide and conquer` with a time complexity of O(log n) and space complexity of O(1).
Fixes TheAlgorithms#1791 The old algorithm used recursion which takes O(n) time to run, being n the exponent. This new algorithm uses the paradigm of `divide and conquer` with a time complexity of O(log n) and space complexity of O(1). This is a reimplementation of https://www.geeksforgeeks.org/write-a-c-program-to-calculate-powxn/ but this will only work with positive exponent since the signature of the function only allow natural numbers.
Fixes TheAlgorithms#1791 The old algorithm used recursion which takes O(n) time to run, being n the exponent. This new algorithm uses the paradigm of `divide and conquer` with a time complexity of O(log n) and space complexity of O(1). This is a reimplementation of https://www.geeksforgeeks.org/write-a-c-program-to-calculate-powxn/ but this will only work with positive exponent since the signature of the function only allow natural numbers.

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

Currently implemented
powfunction will return "time limit exceeded". So, we need to add a new function to make a better execution time.