Arrays and Linked Lists

Review: Chapters 1 and 2 of Goodrich et al represent a review of CSC 1253 / 1350 Introduction to Computer Science I and CSC 1254 / 1351 Introduction to Computer Science II. They are there for reference, as needed.

Reading: Chapter 3 of Goodrich et al.

Sequence Containers

A sequence container is a simple 1-dimensional collection of elements. All sequence containers share the same set of basic operations:


Singly Linked Lists

Doubly Linked Lists

Summary of Operations

Given a collection containing \(n\) elements, how many steps are required (in the worst-case scenario) to perform each basic operation?

Operation Array Single Double
Append 1 \(n\) \(n\)
Erase \(n\) \(n\) 1
Insert After \(n\) 1 1
Insert Before \(n\) \(n\) 1
Index 1 \(n\) \(n\)
Size 1 \(n\) \(n\)
Find \(n\) \(n\) \(n\)

Example: CAT. Append S. Erase T. Insert R after A. Insert T before S.

Things to consider