Skip to content

Add SecondMinMax - #4432

Merged
vil02 merged 22 commits into
TheAlgorithms:masterfrom
BharathSanjeeviT:secondMinMax
Oct 1, 2023
Merged

Add SecondMinMax#4432
vil02 merged 22 commits into
TheAlgorithms:masterfrom
BharathSanjeeviT:secondMinMax

Conversation

@BharathSanjeeviT

Copy link
Copy Markdown
Contributor

Description

This PR provides a feature that contains the Java Program to find second largest / smallest element from the array with the most optimal solution

This PR addresses the Issue #4430

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized it.
  • All filenames are in PascalCase.
  • All functions and variable names follow Java naming conventions.
  • All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations.

I have read code of conduct and provided this PR accordingly

@vil02 vil02 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@BharathSanjeeviT thanks for an interesting contribution. Before we will marge it, I have some remarks.

Please add some proper tests. Good examples to look at:

Comment thread src/main/java/com/thealgorithms/maths/SecondMinMax.java Outdated
Comment thread src/main/java/com/thealgorithms/maths/SecondMinMax.java Outdated
Comment thread src/main/java/com/thealgorithms/maths/SecondMinMax.java Outdated
Comment thread src/main/java/com/thealgorithms/maths/SecondMinMax.java Outdated
Comment thread src/main/java/com/thealgorithms/maths/SecondMinMax.java Outdated
Comment thread src/main/java/com/thealgorithms/maths/SecondMinMax.java Outdated
@vil02 vil02 self-assigned this Sep 29, 2023
@BharathSanjeeviT

Copy link
Copy Markdown
Contributor Author

Hey @vil02 , Thank you for looking into my contribution and suggesting all the changes. Hope I did correct all those you said 👍

@BharathSanjeeviT BharathSanjeeviT left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hope I did solved all the change that you have addressed 👍

@vil02 vil02 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The logic in findSecondMin and findSecondMax is very similar (basically the type of inequality). Do you see some way to remove duplicated code?

By the way, you can commit suggestions directly just by clicking the Commit suggestion button - this automatically resolves the conversation.

Comment thread src/main/java/com/thealgorithms/maths/SecondMinMax.java Outdated
Comment thread src/main/java/com/thealgorithms/maths/SecondMinMax.java Outdated
Comment thread src/main/java/com/thealgorithms/maths/SecondMinMax.java Outdated
Comment thread src/main/java/com/thealgorithms/maths/SecondMinMax.java Outdated
Comment thread src/main/java/com/thealgorithms/maths/SecondMinMax.java Outdated
Comment thread src/main/java/com/thealgorithms/maths/SecondMinMax.java Outdated
Comment thread src/test/java/com/thealgorithms/maths/SecondMinMaxTest.java Outdated
@BharathSanjeeviT

Copy link
Copy Markdown
Contributor Author

Hey @vil02 , made the changes that you have mentioned and btw i thought Commit Changes would add extra commits, thanks for the information 👍

@BharathSanjeeviT BharathSanjeeviT left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Made all these changes 👍

@vil02 vil02 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry for a monster suggestion: sometimes it is easier to express ideas just by writing code.

Comment thread src/main/java/com/thealgorithms/maths/SecondMinMax.java
Comment thread src/test/java/com/thealgorithms/maths/SecondMinMaxTest.java
@BharathSanjeeviT

Copy link
Copy Markdown
Contributor Author

Hey @vil02 , made the changes that you've suggested 👍

@BharathSanjeeviT

Copy link
Copy Markdown
Contributor Author

Hey @vil02 , made the changes that you've suggested 👍

Sorry for a monster suggestion: sometimes it is easier to express ideas just by writing code.

The changes you say, actually making me to learn new things, so i should thank you 👍

@BharathSanjeeviT
BharathSanjeeviT requested a review from vil02 October 1, 2023 07:38

@vil02 vil02 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It is really close!

Comment thread src/main/java/com/thealgorithms/maths/SecondMinMax.java Outdated
Comment thread src/main/java/com/thealgorithms/maths/SecondMinMax.java Outdated
@BharathSanjeeviT

Copy link
Copy Markdown
Contributor Author

Hey @vil02 , the changes you have suggested are made, hope you merge this PR 👍

@BharathSanjeeviT
BharathSanjeeviT requested a review from vil02 October 1, 2023 15:07
Comment thread src/main/java/com/thealgorithms/maths/SecondMinMax.java Outdated
Comment thread src/main/java/com/thealgorithms/maths/SecondMinMax.java Outdated
vil02 added 2 commits October 1, 2023 17:21
Each variable declaration must be in its own statement.
@vil02 vil02 changed the title [FEAT] : Second Minimum / Maximum Element Finder Add SecondMinMax Oct 1, 2023
@vil02
vil02 enabled auto-merge (squash) October 1, 2023 15:26
@vil02
vil02 merged commit 37b3844 into TheAlgorithms:master Oct 1, 2023
@vil02

vil02 commented Oct 1, 2023

Copy link
Copy Markdown
Member

@BharathSanjeeviT thanks for your contribution!

@BharathSanjeeviT

Copy link
Copy Markdown
Contributor Author

Hey @vil02 , Thank you soo much, i loved this process of contributing towards The Algorithms 👍

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.

2 participants