-
-
Notifications
You must be signed in to change notification settings - Fork 331
Implemented the Subset Sum Problem algorithm in R. #171
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
Implemented the Subset Sum Problem algorithm in R. #171
Conversation
Orthodox-64
commented
Oct 8, 2025
- Determines whether a subset exists that sums to a target value using dynamic programming.
- Efficient O(n*sum) DP implementation with O(sum) space-optimized version.
- Handles edge cases including empty arrays, zero targets, and impossible sums.
- Prints DP table, subset verification, and performance comparisons.
- Time Complexity: O(n * sum) for DP table, O(sum) for optimized version.
- Space Complexity: O(n * sum) for DP table, O(sum) for optimized version.
Determines whether a subset exists that sums to a target value using dynamic programming. Efficient O(n*sum) DP implementation with O(sum) space-optimized version. Handles edge cases including empty arrays, zero targets, and impossible sums. Prints DP table, subset verification, and performance comparisons. Time Complexity: O(n * sum) for DP table, O(sum) for optimized version. Space Complexity: O(n * sum) for DP table, O(sum) for optimized version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements the Subset Sum Problem algorithm in R using dynamic programming. The implementation determines whether a subset exists that sums to a target value and includes both standard and space-optimized versions.
Key changes:
- Implements basic DP solution with O(n*sum) time and space complexity
- Provides space-optimized version with O(sum) space complexity
- Includes comprehensive testing with edge cases and real-world examples
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
@siriak pls check now |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!