Reversing the sub - array A [ start ] , A [ start + 1 ] . . A [ end ]
var l = start ; var r = end ; var d = parseInt ( ( r - l + 2 ) / 2 ) ; for ( var i = 0 ; i < d ; i ++ ) { var t = A [ l + i ] ; A [ l + i ] = A [ r - i ] ; A [ r - i ] = t ; }