Java icon indicating copy to clipboard operation
Java copied to clipboard

Add MaximumSubarrayAlgorithm

Open klevinazeraj opened this issue 2 years ago • 7 comments

  • [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 algorithms have a URL in their comments that points to Wikipedia or other similar explanations.

klevinazeraj avatar Apr 19 '23 20:04 klevinazeraj

This algorithm is implemented here https://github.com/TheAlgorithms/Java/blob/1551b8f50ba485b5a7d34fe9ed1fbf650134fb9f/src/main/java/com/thealgorithms/dynamicprogramming/KadaneAlgorithm.java Please make desired changes there

siriak avatar Apr 20 '23 08:04 siriak

This algorithm is implemented here https://github.com/TheAlgorithms/Java/blob/1551b8f50ba485b5a7d34fe9ed1fbf650134fb9f/src/main/java/com/thealgorithms/dynamicprogramming/KadaneAlgorithm.java Please make desired changes there

This algorithm falls under divide and conquer category, are you sure?

klevinazeraj avatar Apr 20 '23 14:04 klevinazeraj

Why is it divide and conquer? I'd say that it's dynamic programming because it just goes over elements 1 by 1 and doesn't explicitly divide input in parts.

siriak avatar Apr 21 '23 08:04 siriak

It cuts down the array in half's the same way merge sort does and then finds the maximum subarray for each of those subarrays and it returns the greatest one. Here is a great video to visualize the process. https://youtu.be/3GD-3UZGsVI

klevinazeraj avatar Apr 21 '23 15:04 klevinazeraj

I see, it differs from what've linked to

siriak avatar Apr 22 '23 07:04 siriak

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar May 23 '23 00:05 github-actions[bot]

Can I work on this issue?

siddhant2002 avatar May 26 '23 07:05 siddhant2002

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jul 11 '23 00:07 github-actions[bot]

Please reopen this pull request once you commit the changes requested or make improvements on the code. If this is not the case and you need some help, feel free to seek help from our Gitter or ping one of the reviewers. Thank you for your contributions!

github-actions[bot] avatar Jul 18 '23 00:07 github-actions[bot]