Skip to content

Fixes(#2877) #2913

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

Closed
wants to merge 27 commits into from
Closed

Fixes(#2877) #2913

wants to merge 27 commits into from

Conversation

siddhant2002
Copy link
Contributor

@siddhant2002 siddhant2002 commented Jan 22, 2022

Describe your change:

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

References

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Java files are placed inside an existing directory.
  • All filenames are in all uppercase characters with no spaces or dashes.
  • All functions and variable names follow Java naming conventions.
  • All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

@siddhant2002
Copy link
Contributor Author

@siriak please check the updated pr for maximum subarray sum

Copy link
Member

@siriak siriak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing, this algorithm is already present here https://github.com/TheAlgorithms/Java/blob/9fb3364cccc5373c32dbdb661f773c5ee753c77a/src/main/java/com/thealgorithms/dynamicprogramming/KadaneAlgorithm.java as far as I can tell, but the old implementation is missing tests, so your improvements are welcome. Could you consolidate your and existing implementations into one?

Comment on lines 10 to 11
int a[]={-1};
assertTrue(KadaneAlgorithm.max_Sum(a));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does it mean? The purpose of the algorithm is to find the largest possible sum, why does it return bool?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically it's checking with the predicted answer

@siriak siriak mentioned this pull request Feb 12, 2022
12 tasks
@794547955
Copy link

794547955 commented Feb 12, 2022 via email

@CrpMihasha
Copy link

CrpMihasha commented Feb 12, 2022 via email

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.

4 participants