OOP Assignment 1 Solution

CIS 4930 Section 0841X

Object-Oriented Programming

Assignment 1 Solution

Variable Length Array

Description: An ordered collection of objects, indexed by an integer, whose size can vary at run time.

Note: there is ambiguity regarding what ordered means in this context. It can be interpreted to mean the objects in the array are in sorted order, and it can also be interpreted to mean that the objects in the array are ordered because each has an index associated with it, the indices are ordered, and you can retrieve successive objects in the array by using successive indices. Your answers to the following depend on which interpretation you made.

Symbol Table

Description: a table that maps text keywords into descriptors.

Note: Carefully consider the description of a symbol table given above. We're not just considering a symbol table for a compiler or assembler; we're considering all tables that map text keywords into descriptors (which could describe anything). This could also be referred to as an associative array using text keys. It would be a mistake to consider one possible application for a class when considering its behavior instead of what operations make sense for a class per se.

Set

Description: an unordered collection of objects with no duplicates.

Note: Neither append, insert, or update is truly right for a set class. What we really want is union. We can use union to combine sets, and we can use it to add objects to sets (because an object is a singleton set, after all).

Prepared by ljr@cis.ufl.edu, reviewed by jnw@cis.ufl.edu.
$Id: s1.html,v 1.2 1994/01/25 23:04:34 jnw Exp jnw $