A popular question asked in Data Structures 1 exams/hws/tutorials.
I'll try to give you some hints, if they don't suffice, comment, and I'll give you more hints.
- Remember that you don't have to use just one data structure, you can use several data structures.
- Recall the definition of a median: n/2 of the numbers are larger, and n/2 of the numbers are smaller
- What data structures do you know that are built in O(n), and complex operations on them are O(logn) or less? - Reread the tutorials slides on these data structures.
- It might be easier for you to solve 1+3 seperately from 1+2, and then think about merging them.