(*4a. empty : tree (* an empty tree *) *) val empty = Empty; (* 5/5 points *) fun empty () = Empty; (* 3/5 points *) fun empty(Empty) = true | empty(_) = false (* 2/5 points *) (*4b. member : int -> tree -> bool (* member x t is true if x is in t *) *) fun member(x)(Empty) = false | member(x)(T(_,l,k,r)) = if (x < k) then member(x)(l) else if (x = k) then true else member(x)(r); (*4c. insert : int -> tree -> tree (* insert x t returns a new tree containing the elements of t union {x} *) *) (* The points were divided into two parts, correct insertion into a binary *) (* tree and correct rebalancing of the red-black tree *) (* Binary Insert: 10/10 points *) (* Rebalancing: *) (* 10/10 points: a strong resemblence to Okasaki's solution *) (* 8/10 points: otherwise correct rebalancing *) (* 5/10 points: some problem with rebalancing *)