mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-06 17:29:31 +08:00

* Update directory * Improve PowerSum algorithm implementation and documentation This commit enhances the PowerSum class in the backtracking package. The changes focus on improving code quality, readability, and documentation. Key improvements include: 1. Enhanced code structure and efficiency: - Removed class-level variables for better thread safety - Optimized the recursive approach to avoid unnecessary calculations - Simplified the overall logic for easier understanding 2. Improved readability: - Used more descriptive variable names (e.g., 'targetSum' instead of 'n', 'power' instead of 'x') - Enhanced method structure with a private recursive helper method 3. Better documentation: - Added comprehensive JavaDoc comments explaining the algorithm's purpose and implementation - Clarified the meaning of parameters, especially relating them to the original problem statement (N and X) - Improved inline comments for better code understanding 4. Adhered to Java best practices: - Improved encapsulation by making the recursive method private - Used Math.pow() directly instead of a custom power method 5. Maintained core functionality: - The algorithm still solves the same problem as before, but with improved code quality * updated PowerSum * Refactor PowerSum algorithm implementation and documentation * Refactor PowerSum algorithm implementation and documentation * Refactor code formatting and remove unnecessary line in PowerSum.java * Refactor code formatting and add newline at end of file in .clang-format --------- Co-authored-by: manishraj27 <manishraj27@users.noreply.github.com> Co-authored-by: Bama Charan Chhandogi <b.c.chhandogi@gmail.com>
The Algorithms - Java
You can run and edit the algorithms, or contribute to them using Gitpod.io (a free online development environment) with a single click.
All algorithms are implemented in Java (for educational purposes)
These implementations are intended for learning purposes. As such, they may be less efficient than the Java standard library.
Contribution Guidelines
Please read our Contribution Guidelines before you contribute to this project.
Algorithms
Our directory has the full list of applications.
Description
All Algorithms implemented in Java
algorithmalgorithm-challengesalgorithmsalgorithms-datastructuresdata-structureshacktoberfestjavasearchsortsorting-algorithms
Readme
MIT
161 MiB
Languages
Java
100%