Skip to content

Latest commit

 

History

History
11 lines (9 loc) · 385 Bytes

README.md

File metadata and controls

11 lines (9 loc) · 385 Bytes

algorithm_task

Majority Element

  • Find the Majority element of an array A[1 ... n]: An array is said to have a majority
  • element if more than half of its entries are the same.
  • Example :
  • Input: {3, 3, 4, 2, 4, 4, 2, 4, 4}
  • Output: 4
  • Explanation: The frequency of 4 is 5 which is greater than the half of the size
  • of the array size.