Custom Templatized Data Structure
20.4 Linked Lists
ListNode class-template definition
List class-template definition
Manipulating a linked list
20.5 Stacks
ListNode.h
- same as the above
List.h
- same as the above
The line "#include <new>" in the sample code can be deleted.
Stack.h
- Stack class-template definition (
private inheritance
from List)
A simple stack program
Composition
ListNode.h
- same as the above
List.h
- same as the above
Stack class template
with a
composed
List object
A simple stack program
The only difference from fig20_14.cpp is that, fig20_14.cpp includes "Stack.h", while fig20_15.cpp includes "Stackcomposition.h".
20.6 Queues
ListNode.h
- same as the above
List.h
- same as the above
Queue.h
- Queue clas-template definition
Queue-processing program
20.7 Trees
TreeNode.h
Tree.h
fig_20_22.cpp