Array reversal (source code)

= Array reversal

Reverse the order of entries in an <array> segment by exchanging its outermost unprocessed pair and moving inward. This takes linear time and constant <auxiliary space>. Reversing two adjacent blocks separately and then reversing their union rotates the blocks while restoring each block's internal order.