Pure haskell Red-Black-Tree implemetation git://github.com/wuxb45/Haskell-RBTree.git
|Latest on Hackage:||0.0.5|
This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.
WARNING:This Implementation mainly concerns about functionality.
After that I will improve the performence and efficiency.
to Build & Install for yourself:
shell> runhaskell Setup.lhs configure --user
shell> runhaskell Setup.lhs build
shell> runhaskell Setup.lhs install
on any problem, you may try this:
shell> runhaskell Setup.lhs register
for system, replace '--user' with '--ghc'
add bangpatterns to some data field.
add ghc optimization flags to .cabal
be careful of memory usage. insert 10MiB Int values takes 3 seconds and 800MiB memory space.
add function "searchFast".
rename 'remove*' functions to 'delete*'s.
add functions for search min/max value.
add functions for search for a interval that the two values in the tree holds the given value
modified search functions can accept a 'compare' function like:
(b -> a -> Ordering)
search for an 'a' by first key of a (RBTree (a,b)) canbe done in such way:
> b :: Int
> b = 10
> t :: RBTree (Int,String)
> t = insertOrdList emptyRB [(1,"hello"), (2,"world")]
> result :: (Int,String)
> result = search (\k (k',_) -> k `compare` k') t 2
it returns "Just (2,"world")"
add three operators for insert/delete/search.
updates the comments to co-op with haddock.
delete the RBTreeTest module. clean is better.