Median in a stream

what’s wrong in this code?

@rockstarpkm
Consider this testcase:
1
5
305 213 915 543 331
output should be " 305 259 305 424 331 " and your code is giving “305 259 305 424 543”. Dry run your code for the same you’ll find you should have to add if(temp>data){ swap(temp,data); } just after line 41

@rockstarpkm
Also line 36 should be else if(data>=maxHeap.top()). You have missed condition for data==maxHeap.top()
Here the updated code after these changes.
https://ide.codingblocks.com/s/248988

why data>=maxheap.top() ? Given that all the elements are unique, so at any point of time , it would never be equal to maxheap.top().

@rockstarpkm
I think there must be issue in the testcases, the testcases might have duplicate numbers. Code is working fine for this case