Recursive array reverse implementation