Skip to content

Conversation

@Vinayak-v12
Copy link

This PR optimizes the power() method by replacing the linear recursive
implementation with an exponentiation-by-squaring approach.

✔ Time complexity reduced from O(n) → O(log n)
✔ Handles negative exponents
✔ Keeps same behavior as original implementation
✔ Fully compatible with existing test cases
✔ No API changes

This improves performance and reduces recursion depth while maintaining clean readability.

@codecov-commenter
Copy link

codecov-commenter commented Nov 15, 2025

Codecov Report

❌ Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 78.33%. Comparing base (a008cc2) to head (0537442).

Files with missing lines Patch % Lines
...a/com/thealgorithms/maths/PowerUsingRecursion.java 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master    #7069   +/-   ##
=========================================
  Coverage     78.33%   78.33%           
- Complexity     6670     6672    +2     
=========================================
  Files           753      753           
  Lines         22185    22192    +7     
  Branches       4356     4359    +3     
=========================================
+ Hits          17378    17384    +6     
  Misses         4107     4107           
- Partials        700      701    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants