median-stream-0.7.0.0: Constant-time queries for the median of a stream of numeric data.

Copyright(c) Joseph Canero 2016
LicenseBSD-3
Maintainerjmc41493@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe
LanguageHaskell2010

Data.MedianStream

Description

 

Synopsis

Documentation

data MedianStream a Source #

A MedianStream is a data type that can be inserted into and queried to get a median of a stream of numeric values.

(+>) :: MedianStream a -> a -> MedianStream a Source #

Infix wrapper around insert with the MedianStream on the left. Complexity: O(lgn)

(<+) :: a -> MedianStream a -> MedianStream a Source #

Infix wrapper around insert with the MedianStream on the right. Complexity: O(lgn)

empty :: (Real a, Eq a) => MedianStream a Source #

Create an empty MedianStream with no values. Complexity: O(1)

insert :: a -> MedianStream a -> MedianStream a Source #

Insert a new numeric value into the median stream. Complexity: O(lgn)

median :: MedianStream a -> Maybe Double Source #

Query the MedianStream for the median of the stream of numbers inserted so far. Complexity: O(1)

size :: MedianStream a -> Int Source #

Returns the number of elements in the MedianStream. Complexity: O(1)

fromList :: (Real a, Eq a) => [a] -> MedianStream a Source #

Creates a MedianStream from a list of input elements. Complexity: O(nlgn)

insertList :: (Real a, Eq a) => MedianStream a -> [a] -> MedianStream a Source #

Adds a list of input elements to an existing MedianStream Complexity: O(nlgn)