Getting the median is a pretty basic and frequent requirement. It can be a pretty expensive operation, especially in the case where numbers are constantly being added and medians are regularly required, including between successive add operations. It does not make sense to constantly sort the 'entire' data structure after every insertion or on every call to get a median. This algorithm tries to find the best mid-ground to achieve this.

"Finds the median of a space-delimited integer stream. Median call should work regardless of it being called after insertion of a subset of the full list."

Writing good docs:

Communicate Value

A good introduction should make it clear why someone might use your API.

Show and Tell

Give examples of using your API and explain those examples.

Easy to Skim

Ensure your docs are structured such that familiar users can quickly jump to the content they want.


Revisit your docs after making breaking changes or adding new features to keep them up-to-date.