subject

(a) Write a SCHEME function (make-change n den) which outputs a list of change specifications. Namely, a call (make-change 11 (list 25 10 5 1) produces the list
((1 1 1 1 1 1 1 1 1 1 1) (1 1 1 1 1 1 5) (1 5 5) (1 10))
Hints: a helper function (helper n den cur) that takes as input cur, a list of coins given out so far will surely come in handy! Also, the order in which the "options" appear in the top list is immaterial.

(b) While getting the output above is helpful, it is not particularly readable. Indeed, the list (1 1 1 1 1 1 5) that states 6 pennies and 1 nickel could be far more readable as ((6 . 1) (1 . 5)) also stating 6 pennies and 1 nickel. That is, this is a list of pairs telling us how many of each denomination. Thankfully, the former can be translated into the latter by a conversion known as run length encoding that replaces sequences of an identical value by a pair giving the number of repetition of the value.
Write a SCHEME function (rle coins) which, given a list of coins, returns a list of pairs denoting the number of repetitions of each sequence of consecutive values. As a last example, the list
(list 1 1 1 1 1 1 1 5 5 5 5 1 1 1 10 10 10 1 1 25 25 25 25 25 25)
would be encoded as
( (17. 1) (4.5) (3 . 1) (3. 10) (2 . 1) (6. 25) )
Note how the tree sub-sequences of pennies are not collapsed into a single value. Those are kept as separate pairs. Naturally, this function only works for one element of the output from make-change.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 21:00
The mode is generally used when delivering a presentation to an need now
Answers: 1
question
Computers and Technology, 22.06.2019 05:00
Write a loop that reads positive integers from standard input and that terminates when it reads an integer that is not positive. after the loop terminates, it prints out, on a line by itself and separated by spaces, the sum of all the even integers read, the sum of all the odd integers read, a count of the number of even integers read, and a count of the number of odd integers read, all separated by at least one space. declare any variables that are needed. assume the availability of a variable, stdin, that references a scanner object associated with standard input. that is, stdin = new scanner(system.in); is given.
Answers: 3
question
Computers and Technology, 22.06.2019 10:50
Write a 3-4 page apa formatted paper comparing your organization’s it strategy with the best practices outlined in your course text. content should include, but not be limited to: developing and delivering on the it value, developing it strategy for the business value and linking it to business metrics. your paper should include an abstract and a conclusion and a reference page with 3-5 references
Answers: 1
question
Computers and Technology, 22.06.2019 16:30
Corey set up his presentation for delivery to his team.the information he had to convey was critical to their job performance.he knew he would need a lot of time to explain each point
Answers: 3
You know the right answer?
(a) Write a SCHEME function (make-change n den) which outputs a list of change specifications. Namel...
Questions
question
Mathematics, 11.10.2019 07:50
question
Biology, 11.10.2019 08:00