Array implementation of lists
A list is simply a collection of nodes, the nodes cannot be ordered by the array ordering; each contain within itself a pointer to its successor. Thus a group of 500 nodes might be declared as an array node as follows.
#define NUMNODES 500
Struct nodetype
{
Int info, next;
};
Struct nodetype node[NUMNODES];
Limitations of the Array Implementation
Under the array implementation, a fixed set of nodes represented by an array is established at the start of execution.
The number of nodes that are needed often cannot be predicted when a program is written.
The number of nodes are declared must remain allocated to the program throughout its execution.
The solution to this problem is to allow nodes that are dynamic rather than static.
No comments:
Post a Comment