actually , I am solving a problem:
A list is there in which infinite numbers(approx 1 lakh) are there, and i am reading one by one. At any point of time, I am asked to return the kth(it is given initally) minimum element from the elements read so far.
my approach: I know this question will be solved by using heap(min or max). But , i am not getting how to use heap here? Can any one please give me hints that how heaps will be used here ? whether i should use min or max heap ? please help. thanks.