Tag Archives: n/2 duplicate

Element repeated more than n/2 times – Fast majority vote algorithm

Find the element which repeated more than n/2 times in an given array of integers. For example, A=[2, 2, 3, 2, 3, 3, 1, 3, 1]. We can clearly see that 3 is the majority. A quick an dirty solution would be to either use a Hashmap to count frequency of each element and keep […]