Sets maximum count and stores maximum occured element so far if maximum count becomes greater than n / 2 it breaks out setting the flag
if ( max_ele < count ) { max_ele = count ; ele = arr [ i ] ; if ( max_ele > parseInt ( n / 2 , 10 ) ) { f = 1 ; break ; } } }