Added an algorithm to keep the median in real-time