File size: 352 Bytes
bff4ec7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | import AUXLib.Arithmetic
import SimpleC.SL.SeparationLogic
namespace Algorithms.majority_element.lean
open AUXLib
def count (m : Int) : List Int → Int
| [] => 0
| x :: xs => (if x = m then 1 else 0) + count m xs
def IsMajorityElement (m : Int) (l : List Int) : Prop :=
2 * count m l > (l.length : Int)
end Algorithms.majority_element.lean
|