1
h03
CS32 W19
Name:
(as it would appear on official course roster)
Umail address: @umail.ucsb.edu section
1pm, 2pm, 3pm, 4pm
Optional: name you wish to be called
if different from name above.
Optional: name of "homework buddy"
(leaving this blank signifies "I worked alone"

h03: Abstract Data Types

ready? assigned due points
true Mon 01/14 09:30AM Wed 01/23 09:30AM

You may collaborate on this homework with AT MOST one person, an optional "homework buddy".

MAY ONLY BE TURNED IN IN THE LECTURE LISTED ABOVE AS THE DUE DATE,
OR IF APPLICABLE, SUBMITTED ON GRADESCOPE. There is NO MAKEUP for missed assignments;
in place of that, we drop the lowest scores (if you have zeros, those are the lowest scores.)


Reading: Abstract Data Types, PS 10.3

  1. (10 pts) Fill in the information in the header. The following are required to get the 10 "participation" points.
    • Filling in your name and umail address.

    Also: For paper submission PLEASE submit on ONE SHEET OF PAPER, double-sided if at all possible. If you must submit on two printed sheets write name on BOTH sheets and no staples, paperclips, or folded corners.

  2. Savitch makes the following observations in the introduction to Section 10.3:

    "Unless ... defined and used with care, programmer-defined types can be used in unintuitive ways that make a program difficult to understand and difficult to modify. The best way to avoid these problems is to make sure all the data types you define are ADTs. The way that you do this in C++ is to use classes, but not every class is an ADT. To make it an ADT you must define the class in a certain way..."

    1. (4 pts) What does ADT stand for?
    2. (4 pts) According to Savitch, a data type consists of a collection of values, together with ... what?
    3. (4 pts) According to Savitch, a data type is called an ADT if ... what?
  3. Savitch describes two ways of characterizing what makes a class an ADT: first he describes two things that should be completely separated, and then he describes three rules for achieving that separation. What are the two things that should be separated?
    • First thing: (4 pts)
       
    • Second thing: (4 pts)
       
  4. What are the three rules for keeping those things separate?
    • Rule 1: (4 pts)
       
    • Rule 2: (4 pts)
       
    • Rule 3: (4 pts)
       
  5. (4 pts) When you define an ADT as a class, what items are considered part of the interface for the ADT?
     
  6. (4 pts) When you define an ADT as a class, what items are considered part of the implementation for the ADT?