[Haskell-cafe] Re: inserting values in a binary tree

Achim Schneider barsoap at web.de
Fri May 9 18:46:28 EDT 2008


PR Stanley <prstanley at ntlworld.com> wrote:

> Hi
> data Ord a => Tree a = Nil | Node (Tree a) a (Tree a)
> How would one go about inserting a value in a binary search tree of 
> the above description?
> 
Using a library ;)

Inserting isn't the problem, balancing is where things get interesting:
have a look at

http://en.wikipedia.org/wiki/AVL_tree

-- 
(c) this sig last receiving data processing entity. Inspect headers for
past copyright information. All rights reserved. Unauthorised copying,
hiring, renting, public performance and/or broadcasting of this
signature prohibited. 



More information about the Haskell-Cafe mailing list