Skip to content
Snippets Groups Projects
Commit 9627b877 authored by Hans-Peter Deifel's avatar Hans-Peter Deifel
Browse files

SumBag: Don't throw away whole subtrees when deleting

This was a bug in the `delmin` helper that is used to delete the smallest
element of the right tree. It deleted too much.
parent 624bf4e5
No related branches found
No related tags found
No related merge requests found
......@@ -150,7 +150,7 @@ delOnce e = case snd (NE.uncons (multiplicity e)) of
delmin :: Monoid a => Tree a -> (Element a, Tree a)
delmin Leaf = error "delmin: Empty tree"
delmin (Node _ e Leaf _) = (e, Leaf)
delmin (Node _ e Leaf right) = (e, right)
delmin (Node _ e left right) = (\left' -> balance1 e left' right) <$> delmin left
balanceBound :: Int
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment