The Re-Education (Part 2): Linked Lists
May 25th, 2008 | Published in Professional, Re-education
Linked lists, sometimes simply called lists, are a fundamental data structure in computer science. Languages such as Java and C# do an admirable job of abstracting away the details behind lists, but understanding them is absolutely crucial when building efficient programs.
The way in which linked lists are structured varies, but we will consider a doubly-linked list with external data. By that, we mean that each link in the list will refer to the previous link and the next link in the list, and that the data type that represents the list itself will not contain the data itself, but instead each link will contain a reference (pointer) to its corresponding data. In C++, a naive implementation might look like this:
struct LinkedList
{
LinkedList *prev;
LinkedList *next;
DataType *data;