find major element in O(n) time complexity