Lab 5: Linked List Review

Due March 4

Now that we've had a chance to dive into C++ features like template classes, range-based loops, constructors, and destructors, this lab will back up and review linked lists. Near the beginning of the class, we did an example of a very simple linked list to store integers. There's a related file called lab5start.cpp in the class examples area.
Add a few features to this linked list, and put code in main to test them:
  1. Right now, it has an inefficient insert function, that inserts new integers at the end of the list in O(n) time (since the list must be traversed for each addition). Add push and pop functions to add and remove from the beginning of the list.
  2. Add a remove function, that will remove an item by index
  3. Add a function to check if an item is in the list. It should return a bool if the item is found, false if not.
Resist the temptation to turn this into a C++ class with data protection, etc. The focus this time should be on linked lists specifically, not C++.