JavaScript
JavaScript copied to clipboard
Moore's Voting Algorithm - Boyer-Moore Majority Voting Algorithm
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.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 84.79%. Comparing base (
55ff0ad) to head (1951f32).
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
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.