A Gentle Introduction to Linked Lists


Preface: The following applet is meant as a supplement to an introduction to linked lists. If you are viewing this page, but are not already in one of my classes, you may want to examine some brief lecture notes on this topic, before continuing.


Introduction: This applet is used to demonstrate the concept of a linked list. Each "node" of the linked list is represented by two consecutive cells of memory, where the first cell is the "data" and the second cell is a "pointer" to the next node in the list, represented explicitly as an index of the cell of memory containing the next piece of data. The address of the head of the list must be specified explicitly. Any node which contains an "illegal" pointer to the next item is assumed to denote the end of the list.

You can modify the contents of the memory cell in whatever way you'd like to experiement. As you change the contents of memory, modified cells will be highlighted in red. The applet intentionally leaves the corresponding figure unchanged until you explicitly click on the "Update Figure" button.

For a demonstration, you can either create your own list from scratch or you can click on "Random List" to get you going. Don't forget to click on "Update Figure" to see a picture of the underlying linked list!


Technical Note: We have also had some reports that the applet begins, but that the memory cells or the cell indices do not initially appear correctly. If this is the case, click on the "Reset Memory" button.



Michael Goldwasser