Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- balance :: (Tree a) -> Tree a
- balance (Node l a r)
- | skew (Node l a r) == 2
- | skew l == ~1 = leftRightRot (Node l a r)
- | otherwise = rightRot (Node l a r)
- | skew (Node l a r) == ~2
- | skew r == 1 = rightLeftRot (Node l a r)
- | otherwise = leftRot (Node l a r)
- | otherwise = Node l a r (avlInsert x ab))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement