Recursive merge sort with extra parameter , naxele
function mergeSortRec ( arr , beg , end , maxele ) { if ( beg < end ) { let mid = Math . floor ( ( beg + end ) / 2 ) ; mergeSortRec ( arr , beg , mid , maxele ) ; mergeSortRec ( arr , mid + 1 , end , maxele ) ; merge ( arr , beg , mid , end , maxele ) ; } }