Copyright | (c) Joseph Canero 2016 |
---|---|
License | BSD-3 |
Maintainer | jmc41493@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe |
Language | Haskell2010 |
- data MedianStream a
- (+>) :: MedianStream a -> a -> MedianStream a
- (<+) :: a -> MedianStream a -> MedianStream a
- empty :: (Real a, Eq a) => MedianStream a
- insert :: a -> MedianStream a -> MedianStream a
- median :: MedianStream a -> Maybe Double
- size :: MedianStream a -> Int
- fromList :: (Real a, Eq a) => [a] -> MedianStream a
- insertList :: (Real a, Eq a) => MedianStream a -> [a] -> MedianStream a
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)