Getting error in running median

https://ide.codingblocks.com/s/120097 thought i understood logic and my code is correct but dont know what mistake i am doing
please update my code and tell me what is wrong in my code

@bishtmanish786
Input :
1
6
5 15 12 13 2 8

Expected Output :
5 10 12 12 12 10

Your Output :
5 10 15 12 12 10

@tarunluthra
@pratyush63
this is my updated code https://ide.codingblocks.com/s/120321 still no test case passed

@bishtmanish786
Rather than comparing with maxheap.top() , compare with median while deciding which heap to push k into.
Here’s your updated code - https://ide.codingblocks.com/s/120350

1 Like

the output should be 5 10 12 12.5 12 10

okay i got it. We had to print the integer part of the median only.