I have N keys.
I need to find a data structure which i can do with the following operations :
-
building it in O(N)
-
finding min in O(1)
-
deleting the median in O(logn)
-
finding the n/2+7-th biggest number
I thought about using a minimum heap (building is O(n),minimum is O(1) – root).
however, I’m having hard time finding a way to do 3 and 4.
I think the median suppose to be on of the leaves, but that’s as far as i reached.
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.