-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Constant-time queries for the median of a stream of numeric
--   data.
--   
--   Uses the two-heap approach to support O(lg n) insertions and O(1)
--   queries for the median.
@package median-stream
@version 0.7.0.0


module Data.MedianStream

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

-- | Infix wrapper around insert with the MedianStream on the left.
--   Complexity: O(lgn)
(+>) :: MedianStream a -> a -> MedianStream a

-- | Infix wrapper around insert with the MedianStream on the right.
--   Complexity: O(lgn)
(<+) :: a -> MedianStream a -> MedianStream a

-- | Create an empty MedianStream with no values. Complexity: O(1)
empty :: (Real a, Eq a) => MedianStream a

-- | Insert a new numeric value into the median stream. Complexity: O(lgn)
insert :: a -> MedianStream a -> MedianStream a

-- | Query the MedianStream for the median of the stream of numbers
--   inserted so far. Complexity: O(1)
median :: MedianStream a -> Maybe Double

-- | Returns the number of elements in the MedianStream. Complexity: O(1)
size :: MedianStream a -> Int

-- | Creates a MedianStream from a list of input elements. Complexity:
--   O(nlgn)
fromList :: (Real a, Eq a) => [a] -> MedianStream a

-- | Adds a list of input elements to an existing MedianStream Complexity:
--   O(nlgn)
insertList :: (Real a, Eq a) => MedianStream a -> [a] -> MedianStream a
