anchor.diff:          | Node (Empty, r, _, _) -> r
           | Node (left, Empty, _, _) ->
               left
  -        | Node (left, right, _, _) ->
  -            let new_n, l = AvlTree.DeleteMax left
  -            AvlTree.mkt_bal_r (new_n, l, right)
  +        | Node (left, r, _, _) ->
  +            let root, l = AvlTree.DeleteMax left
  +            AvlTree.mkt_bal_r (root, l, r)
   
       /// Removes the minimum (least) value from a AvlTree,
       /// returning the value along with the updated tree.
       /// No exception is thrown if the tree is empty.
       static member TryDeleteMin (tree : AvlTree<'T>) =
  -        // Is the tree empty?
  -        if AvlTree.IsEmptyTree tree then
  +        match tree with
  +        | Empty ->
               None, tree
  -        else
  -            let minElement, tree = AvlTree.DeleteMin tree
  -            Some minElement, tree
  +        | Node (l, Empty, n, _) ->
  +            Some n, l
  +        | Node (left, r, n, _) ->
  +            let na, l = AvlTree.TryDeleteMin left
  +            match na with
  +            | None ->
  +                na, l
  +            | Some _ ->
  +                na, AvlTree.mkt_bal_r (n, l, r)
   
       /// Removes the maximum (greatest) value from a AvlTree,
       /// returning the value along with the updated tree.
       /// No exception is thrown if the tree is empty.
       static member TryDeleteMax (tree : AvlTree<'T>) =
  -        // Is the tree empty?
  -        if AvlTree.IsEmptyTree tree then
  +        match tree with
  +        | Empty ->
               None, tree
  -        else
  -            let maxElement, tree = AvlTree.DeleteMax tree
  -            Some maxElement, tree
  +        | Node (l, Empty, n, _) ->
  +            Some n, l
  +        | Node (l, right, n, _) ->
  +            let na, r = AvlTree.TryDeleteMax right
  +            match na with
  +            | None ->
  +                na, l
  +            | Some _ ->
  +                na, AvlTree.mkt_bal_l (n, l, r)
   
       /// Removes the specified value from the tree.
       /// If the tree doesn't contain the value, no exception is thrown;
  
positive.code:         | _ ->
              AvlTree<'T>.CompareStacks (comparer, [s1], [s2])
  
      /// Returns the height of a AvlTree.
      [<Pure>]
      static member private ComputeHeight (tree : AvlTree<'T>) =
          match tree with
  
negative.code:         | Node (_,_,_,h) -> h
  
      /// Returns the absolute difference in heights between two AvlTrees.
      [<Pure>]
      static member private HeightDiff (t1, t2 : AvlTree<'T>) =
          (max (AvlTree.Height t1) (AvlTree.Height t2)) - (min (AvlTree.Height t1) (AvlTree.Height t2))
  
  