Assignment #12: Higher-order Functions

Out: Thursday, April 2nd   Due: Thursday, April 9th, 4:00pm

This homework must be done and submitted with your partner. Please see the submissions page for details on how to submit with your partner.



Questions

  1. Problem 23.2.1 from Section 23.2 of How to Design Programs
  2. Problem 23.2.4
  3. Problem 23.2.5
  4. Design the function merge, which takes two sorted lists of Numbers and combines them into one sorted list of Numbers. Remember the template for processing two lists.
  5. Use merge to design the merge-sort function. This function uses generative recursion. It splits a list into two halves, then recursively sorts each half, then merges the results back together. Think about what the trivial case is for this generative recursion. You might compare this to (but do not do) Problem 26.1.2 from Section 26.1.