Question: [RACKET CODING RECURSIVE] 4. Two common operations on sets are union and intersection. The union of two sets is the set of all elements that
[RACKET CODING RECURSIVE]
![[RACKET CODING RECURSIVE] 4. Two common operations on sets are union and](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f2e92d3c4db_43666f2e92ccecd5.jpg)
4. Two common operations on sets are union and intersection. The union of two sets is the set of all elements that appear in either set (with no repetitions). The intersection of two sets is the set of elements that appear in both sets. Write Racket functions (union si $2) and (intersect si S2) that implement set union and set intersection. Test cases: (union '(1 2 3) (3 2 1)) ---> (1 2 3) (union '(1 2 3) '(3 4 5)) ---> (1 2 3 4 5) (union '(a b c) '(3 2 1)) ---> (a b c 1 2 3) (intersect '(1 2 3) '(3 2 1)) ---> (1 2 3) (intersect '(1 2 3) '(4 5 6)) ---> 0) (intersect '(1 2 3) '(2 3 4 5 6)) ---> (23) The ordering of the elements in your answer may differ from the above. 4. Two common operations on sets are union and intersection. The union of two sets is the set of all elements that appear in either set (with no repetitions). The intersection of two sets is the set of elements that appear in both sets. Write Racket functions (union si $2) and (intersect si S2) that implement set union and set intersection. Test cases: (union '(1 2 3) (3 2 1)) ---> (1 2 3) (union '(1 2 3) '(3 4 5)) ---> (1 2 3 4 5) (union '(a b c) '(3 2 1)) ---> (a b c 1 2 3) (intersect '(1 2 3) '(3 2 1)) ---> (1 2 3) (intersect '(1 2 3) '(4 5 6)) ---> 0) (intersect '(1 2 3) '(2 3 4 5 6)) ---> (23) The ordering of the elements in your answer may differ from the above
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
