Find elements larger than half of the elements in an array | Prints elements larger than n / 2 element ; Sort the array in ascending order ; Print last ceil ( n / 2 ) elements ; Driver Code
function findLarger ( arr , n ) { arr . sort ( ) ; for ( let i = n - 1 ; i >= n / 2 ; i -- ) document . write ( arr [ i ] + " " ) ; } let arr = [ 1 , 3 , 6 , 1 , 0 , 9 ] ; let n = arr . length ; findLarger ( arr , n ) ;