Archived Content

This website is an archive of the Spring 2019 semester of CS 225.
Click here to view the current semester.
Back to Notes

Linked Lists

by Eddie Huang
A Brief Intro to Graph Notation

Graphs consist of a set of nodes (also known as vertices) and edges that form connections between nodes.

A graph with two nodes and a directed edge between them
Linked Lists

Linked lists are ideally used to store information that require some sort of order to them. A linked list is a special type of graph where the nodes and edges form a chain-like structure. The nodes at the end contain only one edge, while the internal nodes contain two edges (one incoming and one outgoing edge). The first node is called the head and the last node is called the tail.

A singly linked list
A doubly linked list

There are two main types of linked lists: singly linked lists and doubly linked lists. In a singly linked list, there only exist forward edges (i.e. edges only connect from one node to the next node in the list). In a doubly linked list, there exist both forward and back edges.