Write a function two-subsets in Scheme that takes a list L of positive integers (duplicates are possible, zero is not considered a positive integer) and some auxiliary parameters of your choice.

Write a function two-subsets in Scheme that takes a list L of positive integers (duplicates are possible, zero is not considered a positive integer) and some auxiliary parameters of your choice. The function two-subsets returns #t if the list L contains two subsets with equal sums of elements and with equal numbers of elements. Otherwise (if two subsets satisfying the condition above do not exist), the function returns #f. Assume that the list L contains at least two integers.

Note that here, it is not required that the whole list be split into two subsets. In HW3, some elements of the list could be left out from the two subsets. Therefore, every list, which is a solution to HW2 is also be a solution to HW3. However, there are solutions to HW3 that are not solutions to HW2.

It is up to you to choose the auxiliary parameters that two-subsets takes. All auxiliary parameters must be numeric (not lists) and should have initial values set to zero. For example, if L is ‘(1 2 3) and if you decide to use two additional auxiliary parameters, then two-subsets must be called as follows:

(two-subsets ‘(1 2 3) 0 0)

If there are three auxiliary parameters, then the function must be called:

(two-subsets ‘(1 2 3) 0 0 0) and so on.

Note that the function must be called two-subsets. Other names will not be accepted. The list must precede the auxiliary parameters, which are initially set to zeroes.

There is no need to optimize your code. Try to come up with a working solution.

Examples (for the sake of illustration, two auxiliary parameters are used):

(two-subsets ‘(7 7) 0 0) returns #t. The two subsets are {7} and {7}.

(two-subsets ‘(7 7 1) 0 0) returns #t. The two subsets are {7} and {7}.

(two-subsets ‘(5 3 2 4) 0 0) returns #t. The two subsets are {2, 5} and {3, 4}.

(two-subsets ‘(5 3 21 2 4) 0 0) returns #t. The two subsets are {2, 5} and {3, 4}.

(two-subsets ‘(2 13 7 5 16 11) 0 0) returns #t. The two subsets are {7, 11} and {5, 13}.

(two-subsets ‘(1 2 3 6 9) 0 0) returns #f.

(two-subsets ‘(10 4 7 102 36 6 17 54) 0 0) returns #f.

The whole solution must be packed in one recursive function two-subsets which must look as follows:


 

PLACE THIS ORDER OR A SIMILAR ORDER WITH NURSING HOMEWORK HELP TODAY AND GET AN AMAZING DISCOUNT


For orders inquiries       +1 (408) 800 3377