Skip to content

Add FindSecondLargestSort#523

Merged
itsvinayak merged 9 commits intoTheAlgorithms:masterfrom
MatthewPalmer9:add-find-second-largest-sort
Apr 3, 2021
Merged

Add FindSecondLargestSort#523
itsvinayak merged 9 commits intoTheAlgorithms:masterfrom
MatthewPalmer9:add-find-second-largest-sort

Conversation

@MatthewPalmer9
Copy link
Copy Markdown
Contributor

Welcome to JavaScript community

Describe your change:

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

Checklist:

  • [ x ] I have read CONTRIBUTING.md.
  • [ x ] This pull request is all my own work -- I have not plagiarized.
  • [ x ] I know that pull requests will not be merged if they fail the automated tests.
  • [ x ] This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • [ x ] All new JavaScript files are placed inside an existing directory.
  • [ x ] All filenames should use the UpperCamelCase (PascalCase) style. There should be no spaces in filenames.
    Example:UserProfile.js is allowed but userprofile.js,Userprofile.js,user-Profile.js,userProfile.js are not
  • [ x ] All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
  • [ x ] If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

@marsonya marsonya requested a review from pomkarnath98 January 22, 2021 02:55
Copy link
Copy Markdown
Contributor

@marsonya marsonya left a comment

Choose a reason for hiding this comment

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

This doesn't really look like an algorithm.
The second largest number can be derived using any of the sort algorithm and simply accessing the second index.

@pomkarnath98, @itsvinayak, @ruppysuppy what do you guys think?

@marsonya marsonya requested a review from itsvinayak January 22, 2021 02:57
@marsonya marsonya added the on hold Being discussed by the maintainers label Jan 22, 2021
@MatthewPalmer9
Copy link
Copy Markdown
Contributor Author

@marsonya The issue with accessing the second number is when you get an array such as:

[1, 2, 4, 6, 7, 8, 10, 10]

The second largest is 8, but choosing the second to last index would return 10. This algorithm filters for unique values. It bypasses the case of repeating numbers.

@ruppysuppy
Copy link
Copy Markdown
Member

This doesn't really look like an algorithm.

I too feel the same. Let's hear what others think

@stale
Copy link
Copy Markdown

stale bot commented Mar 19, 2021

This issue 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.

@stale stale bot added the wontfix Will not be fixed or is a feature label Mar 19, 2021
Copy link
Copy Markdown
Member

@itsvinayak itsvinayak left a comment

Choose a reason for hiding this comment

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

@stale stale bot removed wontfix Will not be fixed or is a feature labels Apr 3, 2021
@itsvinayak itsvinayak removed the on hold Being discussed by the maintainers label Apr 3, 2021
Copy link
Copy Markdown
Member

@ruppysuppy ruppysuppy left a comment

Choose a reason for hiding this comment

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

I believe that

@itsvinayak itsvinayak merged commit d43de68 into TheAlgorithms:master Apr 3, 2021
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