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

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!