The purpose of lab today is to start working on the ADT parts of Homework 8.
We’re going to get started writing code to help with homework 8 today. If you’ve already written code for this, start there. Otherwise, create a new c file called linkedlist.c and download the associated header file linkedlist.h.
From last lab, we created a Makefile and wrote a few functions that were mostly written in lecture. Before starting on this lab, createNode and most of insertSorted need to be written. In addition, the recursive version of printList used for singly linked lists that we wrote during class can be reused here.
Today we’re going to focus on the stack method pushStack. This method will treat the list as a stack. It will insert data at the head of a list and return the updated head pointer.
Points will be allocated as follows
Continue working on homework 8 and the associated testing code. Test your code with valgrind to make sure that your code doesn’t leak any memory. Think about the optimal run time of each method – how does the run times of your methods compare?
It’s ok not to finish this assignment – get through as much as you can.
Zip up your linkedlist.c file (and perhaps also your studentlisttest.c file) into a zip file entitled yourCSUsername.zip. Then drop the zip file into the dropbox under the lab-10 folder.