The Wayback Machine - https://web.archive.org/web/20201103191631/https://github.com/TheAlgorithms/Java/issues/1791
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FastPow #1791

Open
suksest opened this issue Oct 15, 2020 · 0 comments · May be fixed by #1942
Open

Add FastPow #1791

suksest opened this issue Oct 15, 2020 · 0 comments · May be fixed by #1942

Comments

@suksest
Copy link

@suksest suksest commented Oct 15, 2020

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

adrian-rivera added a commit to adrian-rivera/Java that referenced this issue Oct 25, 2020
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).
adrian-rivera added a commit to adrian-rivera/Java that referenced this issue Oct 25, 2020
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.
@adrian-rivera adrian-rivera linked a pull request that will close this issue Oct 25, 2020
8 of 10 tasks complete
adrian-rivera added a commit to adrian-rivera/Java that referenced this issue Oct 25, 2020
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

1 participant
You can’t perform that action at this time.