CIS 22B - Notes for Monday 11/26

Announcements and Reminders

Linked List

A linked list is a data storage technique that allows for a variable size container.  Linked lists typically consists “connected” nodes containing both data and one or more pointers.  The pointer(s) perform the connection to the “next” data item.  Common types of linked lists are single-ended (containing data and one next pointer) and double-ended (containing data and two pointers, next and previous).  Linked list contrainers are implemented in the C++ STL.


This is a multi-file solution

A multiple file application - demonstration

Source Files

Linked List video

Standard Template Library (STL)

vector - dynamic array container

list - bidirectional linear container

forward_list - a single-ended linked list

stack - last-in, first-out (LIFO) adapter

queue - first-in, first-out (FIFO) adapter

The STL solution

Lab Exercise #10

Put your name, the compiler used, and Lab Exercise #10 in a comment at the top of your program. Email your source code. This lab exercise is due at the beginning of the next lecture.

Add a remove_last() function to the List class that was presented in the multi-file solution.  This function should remove the last node (element) in your linked list.  Your function should work no matter how many nodes are in the linked list.  Solve this as a multi-file solution. 

Here are the files needed for this exercise.

Email only the definition of your remove_last() function.