Implemented O(n^2) algorithm for finding majority element