Boyer–Moore majority vote algorithm

Boyer–Moore majority vote algorithm
240 Downloads
Aktualisiert 9 Dez 2015

Lizenz anzeigen

%% Boyer–Moore majority vote algorithm
% The Boyer-Moore Vote Algorithm solves the majority vote problem in
% linear time O(n) and logarithmic space O(\log n). The majority vote
% problem is to determine in any given sequence of choices whether
% there is a choice with more occurrences than all the others, and if so,
% to determine this choice. Mathematically, given a finite sequence
% (length n) of numbers, the object is to find the majority number
% defined as the number that appears more than floor(n/2) times.%
%
% Example:
%
% consider we want to find the majority element in 'aaaccbbcccbcc'
% MajorityVote('aaaccbbcccbcc')
% ans =
% c
%

Zitieren als

Reza Ahmadzadeh (2024). Boyer–Moore majority vote algorithm (https://www.mathworks.com/matlabcentral/fileexchange/54394-boyer-moore-majority-vote-algorithm), MATLAB Central File Exchange. Abgerufen .

Kompatibilität der MATLAB-Version
Erstellt mit R2007a
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux
Kategorien
Mehr zu Genetic Algorithm finden Sie in Help Center und MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Veröffentlicht Versionshinweise
1.0.0.0