This function sorts array from left index to to right index which is of size atmost RUN
function insertionSort ( arr , left , right ) { for ( let i = left + 1 ; i <= right ; i ++ ) { let temp = arr [ i ] ; let j = i - 1 ; while ( j >= left && arr [ j ] > temp ) { arr [ j + 1 ] = arr [ j ] ; j -- ; } arr [ j + 1 ] = temp ; } }