Given a stream of incoming data, how would you design an efficient algorithm to calculate the moving median in real-time?