Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add Majority Element using Boyer-Moore Voting Algorithm#6408

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Aditya-Nagpure wants to merge1 commit intoTheAlgorithms:master
base:master
Choose a base branch
Loading
fromAditya-Nagpure:add-majority-element

Conversation

Aditya-Nagpure
Copy link

Added MajorityElement.java implementing the Boyer-Moore Voting Algorithm (LeetCode#169).
Added JUnit test cases in MajorityElementTest.java under src/test/java/search.

@alxkm
Copy link
Contributor

@Aditya-Nagpure. Thanks for your contribution!

It looks like this algorithm already exists in the repository. Feel free to improve the existing implementations or add tests if you notice any missing edge cases or scenarios.

For reference:

Boyer-Moore:

https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/others/BoyerMoore.java

https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/others/BoyerMooreTest.java

Boyer-Moore:

https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/searches/BoyerMoore.java

https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/searches/BoyerMooreTest.java

And related to Majority Element but not Boyer-Moore:

https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/datastructures/hashmap/hashing/MajorityElement.java

https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/datastructures/hashmap/hashing/MajorityElementTest.java

Thanks again for your contribution.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@DenizAltunkapanDenizAltunkapanAwaiting requested review from DenizAltunkapanDenizAltunkapan is a code owner

@yanglbmeyanglbmeAwaiting requested review from yanglbmeyanglbme is a code owner

@vil02vil02Awaiting requested review from vil02vil02 is a code owner

@alxkmalxkmAwaiting requested review from alxkmalxkm is a code owner

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@Aditya-Nagpure@alxkm

[8]ページ先頭

©2009-2025 Movatter.jp