-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Moore's Voting Algorithm - Boyer-Moore Majority Voting Algorithm #1750
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1750 +/- ##
==========================================
+ Coverage 84.76% 84.79% +0.02%
==========================================
Files 378 379 +1
Lines 19738 19770 +32
Branches 2957 2962 +5
==========================================
+ Hits 16731 16763 +32
Misses 3007 3007 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also get rid of the unrelated changes to package[-lock].json
. Otherwise this looks fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid there are still unrelated changes in this PR. Essentially all changes that aren't to MooreVotingAlgorithm.*
should not be in this PR.
The Boyer-Moore voting algorithm is one of the popular optimal algorithms which is used to find the majority element among the given elements that have more than N/ 2 occurrences. This works perfectly fine for finding the majority element which takes 2 traversals over the given elements, which works in O(N) time complexity and O(1) space complexity.