Median in a running stream of numbers

can’t we do this question as ->
at every insertion,
we put element in min heap so that array remains sorted at every step and at every step we check
if size of heap is odd or even and show output according to that?

Hello @CODER_JATIN though I didn’t get exactly what you want to say.
But if you can implement the same and then share that code then I will check that.

okay , i’ll share code with you

okay , please tell me one thing that , can we access direct element through index in priority queue?

@CODER_JATIN no i dont think because priority is not that data structure it is for arranging the elements.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.