CS 3304 Homework Assignment 5

25 Points
Due: 02/24 at the start of class

Note: The following instructions are repeated from the Homework Dates/Guidelines page:

Your solutions for each homework assignment must be prepared with a word processor (e.g., LaTeX or Word), and are due at the beginning of class on the due date specified unless otherwise noted on the assignment itself.

Note that all homework problems taken from the text are in the Problem Sets. Do not turn in solutions to Review Questions by mistake!

Also, remember that the 5th Edition text includes a new chapter--Chapter 4. All chapter numbers in homework assignments are from the 5th Edition, so students with earlier versions of the text must remember that in their books, the chapter numbers are off by one. If you have an earlier version of the text, you are still responsible for solving the correct problems.

Complete each of the following problems:

  1. Chapter 5, Problem 4 (Chapter 4 in 4th ed.)

  2. Chapter 5, Problem 13 (Chapter 4 in 4th ed.)

  3. Write your own implementation of the Scheme built-in function sublist:

    (sublist list start end)

    Returns a newly allocated list formed from the elements of list beginning at index start (inclusive) and ending at end (exclusive). You may assume that start and end are integers that satisfy:

         0 <= start <= end <= (length list)
    

    Name your function my-sublist, since sublist is already provided as a standard operation in Scheme (you may not use sublist, list-head, or list-tail in your solution).