Lab: Implementing Stacks and Queues with Lists

In today’s lab, you will complete the implementation of stack and queue data structures using linked lists. Unlike most of our previous labs, this one does not have separate parts or exercises; you’ll need to complete the entire implementation, but it is up to you to decide what to do and in what order. The only requirement, other than standard good C coding practices, is that you use linked lists to store the data held in your stack and queue.

Getting Started

The starter code for today’s lab is available from the git server at https://git.cs.grinnell.edu/csc161/stacks-queues-lists. Create a fork, give your lab group access, and clone the fork as usual:

$ cd csc161/labs
$ git clone https://git.cs.grinnell.edu/YOUR_USERNAME/stacks-queues-lists
$ cd stacks-queues-lists
$ code .

Lab Instructions

The starter code for this lab is the same as the array version we used in our previous class. As before, you should only edit the struct definitions in the provided header files and function implementations in the .c file for each data structure. Do not edit the driver programs, and do not change the functions that make up the interface for the stack or the queue. You are welcome to add additional structs to the string_stack.h and string_queue.h header files if necessary.