Programming assignment #0: Implementing queues

CSC 323: Software design · Spring, 2012

Department of Computer Science · Grinnell College

The principal goal of this initial assignment is to give me a sense of your general approach to programming and your style of design, development, and coding. I've therefore chosen an exercise that poses no great problems either in conception or execution: implementing queues.

As you know from earlier courses in computer science, queues are mutable data structures that impose a linear ordering on their components and a first-in, first-out discipline on access to those components. The only component of a queue that can be inspected, and the only one from which a stored value can be extracted, is the one that was least recently added to the queue.

The header file /home/stone/courses/software-design/code/queue.h provides an interface specification for queues. It specifies that a queue is a pointer to a struct, but leaves it to the implementer to define the type of that struct, and gives the prototypes for six basic functions:

The void-pointer type is used in these prototypes for the values stored in queues, in the expectation that callers cast such values to this type when supplying them as arguments and cast them back again into their original types when receiving them as returned values.

The assignment is to design, write, and test an implementation of queues as specified in this header file. You must, at a minimum, create a queue.c file in which you define the struct queue_structure type and write the bodies of the six prototyped functions. In your implementation, you may define additional incidental types and functions, but you should not modify queue.h.

In developing your solution to this exercise, please do not work together or copy program code from anyone else, even with their permission. On this occasion, I'm trying to see how you approach the exercise and to understand your individual style. There will be plenty of opportunities to work collaboratively in this course, and I'll be able to structure those opportunities better if I have a good sense of what your individual strengths and weaknesses are.

To submit your solution to this assignment, make a tarball (that is, create a compressed tape-archive file, in .tgz format) containing your queue.c file and any test programs that you created. If you created a Makefile or any files containing program data, documentation, or test output, include them in the tarball as well, but don't send executables or object files -- I'll recompile them if I need them. Attach the tarball to an e-mail message to stone@cs.grinnell.edu with the subject line "CSC 323: Programming assignment #0".

This assignment is due on Friday, January 27.