end while /set the parentsright pointer of largestv alue to findparent(largestv alue valueright nodet oremove value largestv alue value end if while path count checkbalance(path pop()/we trackback to the root node check balance end while count count return true end remove summary the avl tree is sophisticated self balancing tree it can be thought of as the smarteryounger brother of the binary search tree unlike its older brother the avl tree avoids worst case linear complexity runtimes for its operations the avl tree guarantees via the enforcement of balancing algorithms that the left and right subtrees differ in height by at most which yields at most logarithmic runtime complexity