We wanted to have a function that could reverse a string in-place like this:
char str[] = "ABCDEF";
Reverse(str, strlen(str));
So we implemented this generic recursive Reverse() function:
template<typename T>
void Reverse(T* arr, size_t len) {
if(len > 1) {
std::swap(arr[0], arr[len-1]);
/* Reverse(??, ??); */
}
}
The recursive call in above code is omitted for you to fill in. Which one of followings should replace the comment in above code to complete the implementation of Reverse()?