[Haskell-beginners] Re: How to delete a range from AVL tree.

Alexander.Vladislav.Popov alexander.vladislav.popov at gmail.com
Fri Sep 17 04:25:44 EDT 2010


Thank you very much, Stephen and Jean!
I guess I missed something in my tests.
You definition gives me valid results.
How I can missed it!

Thank you very much again!

2010/9/17 jean verdier <verdier.jean at gmail.com>

> I think that your compare function has the result inverted, you could
> try:
>
> between a b x
>  | x < a     = GT
>  | x > b     = LT
>  | otherwise = EQ
>
> I think that the tree is correct.
>
>
> On Fri, 2010-09-17 at 08:41 +0100, Stephen Tetley wrote:
> > Hello Alexander
> >
> > I suspect mydelete' isn't working because it needs a "sorted" tree -
> > either the initial tree you are supplying isn't sorted or it becomes
> > unsorted after one delete step.
> >
> > I don't know the AVL library at all (I only installed it now to look
> > at your problem) so I can't say from looking at the constructors
> > whether the problem tree is malformed, the problem tree being:
> >
> > > P (Z E 1 E) 3 E
> >
> > Potentially very few people use the Avl module which is why you
> > haven't had a reply yet. You could try posting to the Cafe instead if
> > you don't get a better answer.
> >
> > Best wishes
> >
> > Stephen
> > _______________________________________________
> > Beginners mailing list
> > Beginners at haskell.org
> > http://www.haskell.org/mailman/listinfo/beginners
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20100917/f25ce943/attachment.html


More information about the Beginners mailing list