Divide the array into two equal length subarrays and recursively find the largest among the two
let compared1 = findLargest ( beg , Math . floor ( ( beg + end ) / 2 ) , arr , n ) ; let compared2 = findLargest ( Math . floor ( ( beg + end ) / 2 ) + 1 , end , arr , n ) ; if ( compared1 [ 1 ] > compared2 [ 1 ] ) { let k = compared1 [ 0 ] + 1 ;