text: Function to reverse an array . An array can be reversed in O ( n ) time and O ( 1 ) space .
code: function reverse ( arr , l , r ) { if ( l < r ) { arr = swap ( arr , l , r ) ; reverse ( arr , ++ l , -- r ) ; } }