Given a read-only array with n elements, find the median (the ceiling(n/2)-th element by size) in the array, with O(logn) space and average time O(nlogn).
- The elements in the array are different.
- The array is not sorted.
- You can't change any of the values in the array, only read them
I thought about using the idea of Quicksort but it is impossible to perform it without changing the array. And to copy to another array would exceed the required space.