[Haskell-cafe] I need help on AVL trees

Stefan O'Rear stefanor at cox.net
Fri Apr 27 09:44:04 EDT 2007


On Fri, Apr 27, 2007 at 05:27:37AM -0700, iliali16 wrote:
> Can someone advise me how can I build an AVL tree becouse I have difficulties
> with the rotations. Since if I add a node I want to be abel to check whether
> the tree is balanced or not if balanced ok but if not I need to do one of
> the 4 rotations which is a problem for me and I want to be able to give the
> nodes from the keyboard. What I mean is that it is possible to build the
> tree from scratch. Thanks to all!

If you just want a balanced tree, check out Data.Map, which is in the
standard library so you don't need to figure out how to write it. 

http://haskell.org/ghc/dist/current/docs/libraries/base/Data-Map.html


More information about the Haskell-Cafe mailing list