Moore-s-voting-algorithm This algorithm finds the majority element under linear time, and the total space needed is O(1).