From bd3b4e7d8a436685f8b676da8f6ffe9498ab2e3f Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 1 Jul 2021 15:16:19 +1000 Subject: Added copyright notices and license headers to website content. also removed more unused files. --- microposts/boyer-moore.md | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 microposts/boyer-moore.md (limited to 'microposts/boyer-moore.md') diff --git a/microposts/boyer-moore.md b/microposts/boyer-moore.md deleted file mode 100644 index e3e0f9c..0000000 --- a/microposts/boyer-moore.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -date: 2018-06-04 ---- - -The [Boyer-Moore algorithm for finding the majority of a sequence of elements](https://en.wikipedia.org/wiki/Boyer–Moore_majority_vote_algorithm) falls in the category of "very clever algorithms". - - int majorityElement(vector& xs) { - int count = 0; - int maj = xs[0]; - for (auto x : xs) { - if (x == maj) count++; - else if (count == 0) maj = x; - else count--; - } - return maj; - } - -- cgit v1.2.3