Data Stream Median
Start Timer
0:00:00
Write a function data_stream_median to calculate the new median from a stream of ordered integers and the new element which is not yet inserted into the stream.
The median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value, so the median is the mean of the two middle values.
Example:
new_value = 2
stream = [1, 2, 3, 4, 5, 6]
def data_stream_median(new_value, stream): -> 3
.
.
.
.
.
.
.
.
.
Comments