5. Linked Lists

In This Chapter


A Simple Linked List

Double-Ended Lists

Linked List Efficiency

Abstract Data Types and Objects

Ordered Lists

Doubly Linked Lists

Circular Lists


In Chapter 2, “Arrays,” you saw that arrays had certain disadvantages as data storage structures. In an unordered array, searching is slow, whereas in an ordered array, insertion is slow. In both kinds of arrays, deletion is slow. Also, the size of an array can’t be changed after it’s created. If a larger or smaller array is needed, a new array can be created, but all the items it contains need to be copied into the new structure, which is slow.

In this chapter we look at a data storage structure that solves some of these problems: the ...

Get Data Structures & Algorithms in Python now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.