Function to print half of the array in ascending order and the other half in descending order
function printOrder ( arr , n , k ) { let len1 = k , len2 = n - k ; let arr1 = new Array ( k ) ; let arr2 = new Array ( n - k ) ;