4.1.1 Representation

The basic representation of a list requires two factors. First, it needs to represent the value of the first element. Next, it needs to represent the rest of the list. Using an array as a list is possible, we need to use the following data members in a list:

In C, we can define the internal representation of a list as follows:

struct _List
{
  struct ArrayADT *array; // where values are stored
  unsigned index; // index of the first element
};



Copyright © 2006-09-27 by Tak Auyeung