|
|
|
|
|
|
|
Q Why should I create a linked list if an array will work? |
|
|
|
|
|
|
|
|
A An array must have a fixed size, whereas a linked list can be sized dynamically at run time. |
|
|
|
|
|
|
|
|
Q Why do you separate the data object from the node? |
|
|
|
|
|
|
|
|
A Once you get your node objects working properly, you can reuse that code for any number of objects that might want to live in a list. |
|
|
|
|
|
|
|
|
Q If I want to add other objects to the list, do I have to create a new list type and a new node type? |
|
|
|
|
|
|
|
|
A For now, yes. We'll solve that when we get to templates. |
|
|
|
|
|