ort an array in reverse order and maintain index association