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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.