A Different Setting

This is a pair exercise and must be competed in your tutorial or lab with your partner.

Here’s another ADT: the Set ADT. The Set ADT, like the Stack and Queue ADTs, model a concept you’re likely to encounter elsewhere; a set is a cool mathematical construct, which stores a collection of unique values of the same type.

Download Set.h, or copy it into your current directory on a CSE system by running

$ cp /web/cs1511/17s2/week12/files/Set.h .

The Set ADT defines these methods in its interface:

Create a file called Set.c; in it, you should implement these functions. You probably should use a linked list to store the different items.

To run some simple automated tests:

$ 1511 autotest setADT

To run Styl-o-matic:

$ 1511 stylomatic Set.c
Looks good!

You’ll get advice if you need to make changes to your code.

Submit your work with the give command, like so:

$ give cs1511 wk12_setADT

Or, if you are working from home, upload the relevant file(s) to the wk12_setADT activity on Give Online.