Exercise 2.60. We specified that a set would be represented as a list with no duplicates. Now suppose we allow duplicates. For instance, the set {1,2,3} could be represented as the list (2 3 2 1 3 2 2). Design procedures element-of-set?, adjoin-set, union-set, and intersection-set that operate on this representation. How does the efficiency of each compare with the corresponding procedure for the non-duplicate representation? Are there applications for which you would use this representation in preference to the non-duplicate one? ———————————————————————————————————————————————————————————————————————— Element-of-set? will be unchanged and is still O(n), where n is now the number of items in the representation, which might be greater than the cardinality of the set. Adjoin-set can be implemented as cons and becomes O(1). Union-set becomes a simple append operation which is O(n) in the size of the first list. Intersection-set is unchanged except that, as for element-of-set?, it will become slower with more redundancy in the representations. In an application where adding elements is very common, testing set membership is uncommon, or when the majority of elements added are distinct anyway, this representation may be preferred.