19. Custom Templatized Data Structures

‘Will you walk a little faster?’ said a whiting to a snail, ‘There’s a porpoise close behind us, and he’s treading on my tail.’

—Lewis Carroll

There is always room at the top.

—Daniel Webster

Push on—keep moving.

—Thomas Morton

I’ll turn over a new leaf.

—Miguel de Cervantes

Objectives

In this chapter you’ll:

• Form linked data structures using pointers, self-referential classes and recursion.

• Create and manipulate dynamic data structures such as linked lists, queues, stacks and binary trees.

• Use binary search trees for high-speed searching and sorting.

• Learn important applications of linked data structures.

• Create reusable data structures with class templates, inheritance and composition.

Outline ...

Get C++ How to Program, Ninth Edition now with O’Reilly online learning.

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