stream of numbers

This Question Was Asked By Microsoft

Compute the running median of a sequence of numbers. Given a stream of numbers, print out the median of the list so far on each new element. Recall that the median of an even-numbered list is the average of the two middle numbers.

Write a function solve that have the following parameter(s):
1.) a = an array of integer

Example
Input:
[2, 1, 5, 7, 2, 0, 5]
Output:
The function will return,
2
1.5
2
3.5
2
2
2

Constraints
• The size of an array should be greater than 0 and less than 100.
• The elements of the array should be greater than 0 and less than 1000.