Java icon indicating copy to clipboard operation
Java copied to clipboard

Optimization of SumOfSubset

Open bhishma620 opened this issue 2 years ago • 0 comments

This pull request introduces an enhanced implementation of the Subset Sum algorithm . The algorithm efficiently determines whether there exists a subset of the given array 'arr' that sums up to the specified key. Notable improvements include reduced space complexity through the use of a single boolean array and optimized loop structures. This update aims to enhance code readability and maintainability while preserving the algorithm's correctness and performance.Time complexity of algorithm is O(N*Key) (where N is the size of Array and Key is the subset sum which want to find from the array) and space complexity is O(Key) (use only target sum size boolean array).

  • [x] I have read CONTRIBUTING.md.
  • [x] This pull request is all my own work -- I have not plagiarized it.
  • [x] All filenames are in PascalCase.
  • [x] All functions and variable names follow Java naming conventions.
  • [x] All new code is formatted with clang-format -i --style=file path/to/your/file.java

bhishma620 avatar Jan 26 '24 19:01 bhishma620