Find the majority element in an array
Posted onGiven an unsorted array, find the majority element. Majority element is defined as that element which occurs for more than N/2 times. If the majority element exists, there will only be one such element. We can do this in O(N) time by the Boyer–Moore majority voting algorithm.