TheAlgorithms / C-Plus-Plus

Collection of various algorithms in mathematics, machine learning, computer science and physics implemented in C++ for educational purposes.
https://thealgorithms.github.io/C-Plus-Plus
MIT License
30.79k stars 7.29k forks source link

Implemented moore voting algorithm #2847

Open SuprHUlk opened 1 month ago

SuprHUlk commented 1 month ago

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.

github-actions[bot] commented 4 days ago

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.