Median Maintenance problem using heaps