Dsa
Heap
Easy
Median Tracker
You need to keep track of the median of a stream of integers. Implement a program that takes a series of integers as input (one per line) and returns the current median after each integer. You should manage the stream efficiently using a heap data structure. Input ends when a line with 'END' is encountered. Output should be the median in float format to one decimal place.
Example:
Input:
1
5
2
END
Output:
1.0
3.0
2.0
Key concepts
heapmediandata stream
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now