This pull request implements the Moore Voting Algorithm, addressing the issue #2830. Moore Voting Algorithm is used to find the majority element in an array (the element that appears more than ( \frac{n}{2} ) times). The algorithm works efficiently in O(n) time complexity and O(1) space complexity. The implementation includes:
The algorithm in C++
Self-contained tests verifying the correctness of the implementation
Documentation following Doxygen guidelines, explaining each function and its usage
[x] Searched previous suggestions to confirm this implementation is not a duplicate
[x] I acknowledge that all my contributions will be made under the project's license.
Notes:
This implementation follows the proposed solution in the issue #2830. It includes detailed documentation to explain the algorithm’s logic, making it educational for developers and contributors.
This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Description of Change
This pull request implements the Moore Voting Algorithm, addressing the issue #2830. Moore Voting Algorithm is used to find the majority element in an array (the element that appears more than ( \frac{n}{2} ) times). The algorithm works efficiently in O(n) time complexity and O(1) space complexity. The implementation includes:
Checklist
Notes:
This implementation follows the proposed solution in the issue #2830. It includes detailed documentation to explain the algorithm’s logic, making it educational for developers and contributors.