@@ -0,0 +1,713 @@
+package GeeksforGeeksPractice;%0D%0A%0D%0A/*%0D%0A * Link: http://www.geeksforgeeks.org/check-for-majority-element-in-a-sorted-array/%0D%0A */%0D%0Apublic class _0115CheckMajorityElementArray %7B%0D%0A%09public static void main(String%5B%5D args) %7B%0D%0A%09%09int arr%5B%5D = %7B1, 2, 3, 3, 3, 3, 10%7D;%0D%0A%09%09int x = 3;%0D%0A%09%09System.out.println(checkMajority(arr,x));%0D%0A%09%09arr = new int%5B%5D%7B1, 1, 2, 4, 4, 4, 6, 6%7D;%0D%0A%09%09x = 4;%0D%0A%09%09System.out.println(checkMajority(arr,x));%0D%0A%09%09arr = new int%5B%5D%7B1, 1, 1, 2, 2%7D;%0D%0A%09%09x = 1;%0D%0A%09%09System.out.println(checkMajority(arr,x));%0D%0A%09%7D%0D%0A%0D%0A%09private static boolean checkMajority(int%5B%5D arr, int x) %7B%0D%0A%09%09int count=0;%0D%0A%09%09for (int i = 0; i %3C arr.length; i++) %7B%0D%0A%09%09%09if(arr%5Bi%5D==x)count++;%0D%0A%09%09%7D%0D%0A%09%09return count%3Earr.length/2?true:false;%0D%0A%09%7D%0D%0A%0D%0A%0D%0A%0D%0A%7D%0D%0A

check majority element completed