AVL tree deletion with haskell
Evgeniy Malov
Part 1 - https://www.youtube.com/watch?v=SlAJirZ0KTE&feature=youtu.be Please note: at 2:40 , 9:00 and 19:43 I made symmetric error on line 100 and 129: We need to get max elemenet for left subtree and min element for right subtree: 100: | a == e = if empty_ r then Node mx l_ r else Node mn l r_ where mn = getmin r l_ = delmax l mx = getmax l r_ = delmin r (the error fixed in gist)
Also then we find first possible unballanced node:
129:
| a == e = if empty_ r then Just mxp else Just mns
where
mxp = gmx_pred l
mns = gmn_succ r
How to delete node from AVL tree in Haskell?
Binary search tree - https://youtu.be/TC9YPLyTTDo
code - https://gist.github.com/evgenii-malov/f022f8cf53a4b760b44f528aed9b479b ... https://www.youtube.com/watch?v=DfSeb2fDH3s
351625625 Bytes