Question: This must be done in Scheme, using R5RS format: Write a function min-split in Scheme that takes a list of two or more positive integers

This must be done in Scheme, using R5RS format:

Write a function min-split in Scheme that takes a list of two or more positive integers (duplicates are possible) and other auxiliary parameters of your choice. The list L is flat, i.e., it does not contain sublists. The function min-split returns the size of the minimum split of a list L. It is up to you to choose the auxiliary parameters that min-split 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 you decide to use two additional auxiliary parameters, min-split should be called as follows: (min-split (1 2 3) 0 0) If there are three auxiliary parameters, then it must be called: (min-split (1 2 3) 0 0 0)

Examples: (1 1) returns 0. The minimum split is {1} and {1}. The size of the split is 1 -1 = 0. (1 2 3) returns 0. The minimum split is {1, 2} and {3}. The size of the split is 3 3 = 0. There are other splits such as {1, 3} and {2}; {1} and {2, 3}; and {1, 2, 3} and the empty set. There split sizes are greater than 0, however, so are not minimum splits.

(8 6 10 7) returns 1. The minimum split is {6, 10} and {7, 8}. Its size is 16 15 = 1.

(12 10 11 8 9) returns 4. The minimum split is {11, 12} and {8, 9, 10}. Its size is 27 23 = 4.

The whole solution must be packed in one recursive function min-split which must look as follows (define min-split (lambda () (cond ))) In otherwords, you have to choose your auxiliary parameters and define ONE COND statement.

Inside COND, you can only use ONLY the following constructs: - abs - null? - car - cdr - else - + - - - < - min-split - if - user defined names (for the names of your parameters) - integer literals - parentheses

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!