(defmethod delete-from-node ((node binary-tree-node) k tree) (with-slots (key left right value) node (cond ((comp-= k key) (cond ((and (not left) (not right)) nil) ((not left) right) ((not right) left) (t (apply-right-rotations (adjust-height (replace-with-min node tree)))))) ((comp-< k key) (setf left (delete-from-node left k tree)) (apply-left-rotations (adjust-height node))) (t (setf right (delete-from-node right k tree)) (apply-right-rotations (adjust-height node))))))Source Context